I just installed a ruby 2.2.1 and got this warning when I ran bundle install:
DL is deprecated, please use Fiddle
I came to this question and found the code they pointed out in rbreadline.rb line 4367.
if RUBY_VERSION < '1.9.1'
require 'Win32API'
else
require 'dl'
class Win32API
DLL = {}
TYPEMAP = {"0" => DL::TYPE_VOID, "S" => DL::TYPE_VOIDP, "I" => DL::TYPE_LONG}
I then added the require 'irb' line next to the require 'dl' line as they suggested but this did not remove the warning for me. I realize this may only be a warning but I do not want to comment out the message only to have other problems spring up latter. How do I fix this?
There was a broken version of RubyInstaller that was distributed for about 5 hours.
There were only about 800 downloads of it before someone caught it, but it appears that you are running one of those downloads.
Sorry about that.
Check out the mailing list announcement for more details.
The fix is to re-install using the fixed distribution.
Related
I'm working through Beginning Ruby and am doing the first exercise with the debugger. It has me running ruby -r debug debug_test.rb. The debugger does launch, but not on the file I specified (I've tried several). Instead I get:
Debug.rb
Emacs support available.
/home/henry/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:57: RUBYGEMS_ACTIVATION_MONITOR.enter
I'm not really sure the implications of this, and google provides no insight. In any case, I thought this might be of some use:
(rdb:1) list
[52, 61] in /home/henry/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb
52 if Gem::Specification.unresolved_deps.empty? then
53 begin
54 RUBYGEMS_ACTIVATION_MONITOR.exit
55 return gem_original_require(path)
56 ensure
=> 57 RUBYGEMS_ACTIVATION_MONITOR.enter
58 end
59 end
60
61 # If +path+ is for a gem that has already been loaded, don't
(rdb:1) var local
found_specs => nil
le => nil
load_error => nil
names => nil
path => "debug"
spec => nil
valid => nil
(rdb:1)
While debug_test.rb does not require any gems, considering the mention of rubygems I thought my rvm gemset might be causing the problems. To this end I tried repeating the procedure with newly created (empty) gemset, but the problem persists. After this I tried running with a different version of ruby (1.9.3), where again the error persists. Interestingly it seems that for 1.9.3 the file does not exist:
/home/henry/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:57:
(rdb:1) list
[52, 61] in /home/henry/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb
No sourcefile available for /home/henry/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb
Any help is much appreciated!
I am not seeing this currently 1.9.3p448 with There are many things going on here that may be conspiring against you.
It is sad that Beginning Ruby recommends using this debugger. I bet just about any other one you use, ruby-debug, pry, byebug, trepan won't have this feature. I suppose Beginning Ruby recommends that module because "debug.rb" comes with Ruby, but it is by far not a debugger one would use as a primary debugger.
And then Ruby has changed over time in the way it handles requires. So probably when Beginning Ruby was written (what is the copyright of the edition you are using?) this feature didn't exist, but now it does. I am pretty sure that if you go back to Ruby 1.8 you won't see this. Probably if you go forward to Ruby 2.x you won't see this either.
I just uninstalled my older versions of Ruby, removed all of my gems
(including Rails), and installed Ruby 2.0. In other words, a totally clean re-install. Upon starting IRB, I received this message:
DL is deprecated, please use Fiddle
Note: I'm on a Windows machine.
What does this message mean?
The message you received is common when you have ruby 2.0.0p0 (2013-02-24) on top of Windows.
The message "DL is deprecated, please use Fiddle" is not an error; it's only a warning.
The source is the Deprecation notice for DL introduced some time ago in dl.rb ( see revisions/37910 ).
On Windows the lib/ruby/site_ruby/2.0.0/readline.rb file still requires dl.rb so the warning message comes out when you require 'irb' ( because irb requires 'readline' ) or when anything else wants to require 'readline'.
You can open readline.rb with your favorite text editor and look up the code ( near line 4369 ):
if RUBY_VERSION < '1.9.1'
require 'Win32API'
else
require 'dl'
class Win32API
DLL = {}
We can always hope for an improvement to work out this deprecation in future releases of Ruby.
EDIT:
For those wanting to go deeper about Fiddle vs DL, let it be said that their purpose is to dynamically link external libraries with Ruby; you can read on the ruby-doc website about DL or Fiddle.
You may want to comment out the DL is deprecated, please use Fiddle warning at
C:\Ruby200\lib\ruby\2.0.0\dl.rb
since it’s annoying and you are not the irb/pry or some other gems code owner
I got this resolution at openshift.com.
Resolution:
This error occurs only on Windows machine with Ruby 2.0.0 version.
Until we officially support Ruby 2.0 please downgrade to Ruby 1.9.
On Windows, you can install Ruby 1.9.3 alongside 2.0. Change your
%PATH% to c:\ruby193\ or whatever directory you installed to prior
to installing the gem.
The message "DL is deprecated, please use Fiddle" is not an error; it's only a warning.
Solution:
You can ignore this in 3 simple steps.
Step 1. Goto C:\RailsInstaller\Ruby2.1.0\lib\ruby\2.1.0
Step 2. Then find dl.rb and open the file with any online editors like Aptana,sublime text etc
Step 3. Comment the line 8 with '#' ie # warn "DL is deprecated, please use Fiddle" .
That's it, Thank you.
I ran into this myself when I wanted to make a thor command under Windows.
To avoid having that message output everytime I ran my thor application I temporarily muted warnings while loading thor:
begin
original_verbose = $VERBOSE
$VERBOSE = nil
require "thor"
ensure
$VERBOSE = original_verbose
end
That saved me from having to edit third party source files.
I have a simple ruby file that scraps a price off of walmart's site. I did a gem install scrapi and a gem install tidy. When I run my code on my windows 7 box I get the following error:
Error
c:/Ruby193/lib/ruby/gems/1.9.1/gems/scrapi-2.0.0/lib/scraper/reader.rb:216:in `r escue in parse_page': Scraper::Reader::HTMLParseError: didn't find tidy libs on your system. Please install tidy (http://tidy.sourceforge.net/) (Scraper::Reader ::HTMLParseError)
It appears that it can't find the tidy libraries, so I put it in my path:
Path=C:\Ruby193\lib\ruby\gems\1.9.1\gems\tidy_ffi-0.1.5\lib;C:\Ruby193\lib\ruby\gems\1.9.1\gems\tidy-1.1.2\lib
but it still throws the same can't find tidy libs error.
Thanks in advance for your help.
Code
require 'rubygems'
require 'scrapi'
require 'tidy'
scraper = Scraper.define do
process "div.firstRow div.priceAvail>div>div.PriceCompare>div.BodyS", :price => :text
result :price
end
url = URI.parse("http://www.walmart.com/search/search-ng.do?search_constraint=0&ic=48_0&search_query=LOST+third+season&Find.x=17&Find.y=1&Find=Find")
puts scraper.scrape(url)
I have exactly the same problem, but on Linux.
It is something to do with the find_tidy function in reader.rb - somehow it is not able find the libraries. I just went and commented that line, and it is working fine now.
# Make sure the Tidy path is set and always apply the default
# options (these only control things like errors, output type).
# find_tidy
options = (options || {}).update(TIDY_OPTIONS)
Try it if you are sure you have the tidy libraries in your system.
I had the same problem on a mac.
The offensive code is on line 204 of the reader.rb file. Open it in your favorite editor:
atom /usr/local/lib/ruby/gems/2.2.0/gems/scrapi-2.0.0/lib/scraper/reader.rb
Just comment it out like the previous answer said. Works great after that.
Here's the stack: Sproutcore 1.0.1046. Ruby 1.9.1, in RVM. Thin 1.2.7. Thor 0.13.8. Rack 1.2.1. Eventmachine 0.12.10. Erubis 2.6.6.
When I start the sc-server on any application, my first request to this server produces this in the console log:
ArgumentError: invalid byte sequence in US-ASCII
...followed by this stack trace. (I've listed gems which appear in the stack trace above, but there's a complete gemset list in the same gist as the stack trace.)
Research on the error message points out that this is a common problem with Ruby 1.9, but the stack trace suggests that the problem is in one of the gems somewhere.
I have:
Upgraded my OS (Mac OS X 10.5 to 10.6) in order to get the latest gcc Apple provides.
Reinstalled RVM.
Reinstalled Ruby.
Reinstalled all the relevant gems.
And yet I still have this problem on one system, but not on another. (N.B. there are several devs working on this code, and I'm the only one seeing this problem. I'm 99% certain it's not our code.) I guess what I'm saying is that I've cleared and rebuilt a lot of gems to try to isolate or remove this glitch, and yet I still haven't gotten rid of it.
Where should I look next?
You have some special setting in your bash environment that is setting ruby to use US-ASCII , this happened to me trying to execute sc-server from a remote terminal... I'm not really sure what it is, but it doesn't use UTF-8 and that's when it runs into trouble.
You can probably also change Encoding.default_external
Thanks so much for the Encoding.default_external suggestion. I was having the same problem, despite correctly set magic comments and environment variables. In Rails 2.3.9 I added this before_filter in application_controller.rb, resolved the issue:
def set_encoding
Encoding.default_external = 'UTF-8'
end
I had the same issue with RSS Feeds that I was displaying in a Rails 2.3.8 app with Ruby 1.9.2. My issue wasn't solved by the application_controller.rb before_filter technique mentioned here. The fix was to put the following into "RAILS_ROOT/config/initializers/string_encodings.rb":
Encoding.default_external = 'UTF-8'
That worked for me site-wide, instead of on a controller level.
In my case the ArgumentError occurred during a Capistrano deploy call that envolves ruby's net-ssh (ruby 1.9.2p290, net-ssh 2.3.0). None of the solutions afore mentioned worked and none of the other reasons I've read about so far: i.e. "strange character in key file", etc..
Finally, I found a none ASCII-character in a comment(!) line in my ASCII encoded ~/.ssh/config file. BINGO!
I decided to give Nokogiri a try, and copied the following program straight from http://nokogiri.rubyforge.org/nokogiri/Nokogiri.html (adding only the require 'rubygems' and the I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 constant):
require 'rubygems'
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 = 1
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we’re interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
# Search for nodes by css
doc.css('h3.r a.l').each do |link|
puts link.content
end
It returned no results. But when I changed
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
to
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove').read)
the program worked as expected. Notice that the only difference was the addition of the .read at the end of the line. I would never have figured this out by myself, because just about every bit of example code leaves off the .read. The one place that included it, ironically was a post by one of the Nokogiri developers (at http://tenderlovemaking.com/2008/11/18/underpant-free-excitement). Did something in the API change? What am I missing?
I'm using Nokogiri 1.3.2.
Thank you.
I copied and pasted your (original) code into a Ruby file and ran it on my system (ruby 1.8.6p369, Nokogiri 1.3.2) and it worked fine. Might there be something else in your environment that could be causing the problem? Nokogiri aside, what does open('http://www.google.com/search?q=tenderlove') return for you?
Not sure what your issue is, but the call to open is from open-uri not nokogiri. So do some experimenting taking nokogiri out of play.
$ irb
>> require 'open-uri'
=> true
>> f = open('http://www.google.com/search?q=tenderlove')
=> #<File:/var/folders/LA/LACsuKOVHtaEgmBzsJcGAE+++TI/-Tmp-/open-uri.7455.0>
>> f.read
=> "<!doctype html><head><title>tenderlove - Google Search</title>...
I upgraded to Nokogiri 1.3.3, and upgraded libxml2 to 2.7.3. I no longer need to use the ridiculous I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 = 1 statement to avoid error messages, and the program works without the extraneous .read.
It's always good to check your version of Nokogiri and libxml to make sure they're current.
As of today (9/22/09) this is current on MacOS:
nokogiri -v
---
nokogiri: 1.3.3
warnings: [ ]
libxml:
compiled: 2.7.4
loaded: 2.7.4
binding: extension
(I put a space inside the empty warnings array to keep it from looking like a box.)