H
Henrik Horneber
Hi!
following script (with an existing ftp address) throws an exception.
#file simple_uri
require 'open-uri'
ftp = "ftp://" # ftp address left out in this mail,
# but one that I can acces
open( ftp ){ |f|
f.read
}
# end of file
produces:
:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in `initialize': No
such file or directory - /dev/null (Errno::ENOENT)
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in
`open_uri_original_open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in `open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/net/ftp.rb:497:in
`getbinaryfile'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:600:in
`direct_open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:169:in `open_loop'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:164:in `catch'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:134:in `open_uri'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:424:in `open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:85:in `open'
from simple_uri.rb:3
RTFS'ing *cough* I find that open-uri does this:
[snip]
ftp = Net::FTP.open(self.host)
ftp.login(user, passwd)
# line 600 in open-uri
ftp.getbinaryfile(self.path, '/dev/null', Net::FTP:EFAULT_BLOCKSIZE)
[snap]
Docs for Net::FTP#getbinaryfile say:
--
getbinaryfile(remotefile, localfile = File.basename(remotefile),
blocksize = DEFAULT_BLOCKSIZE) {|data| ...}
Retrieves remotefile in binary mode, storing the result in localfile. If
a block is supplied, it is passed the retrieved data in blocksize chunks.
---
Since I am on Windows, there is no /dev/null to 'store' the file in.
any clues on what I am doing wrong?
regards,
Henrik
following script (with an existing ftp address) throws an exception.
#file simple_uri
require 'open-uri'
ftp = "ftp://" # ftp address left out in this mail,
# but one that I can acces
open( ftp ){ |f|
f.read
}
# end of file
produces:
:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in `initialize': No
such file or directory - /dev/null (Errno::ENOENT)
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in
`open_uri_original_open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:87:in `open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/net/ftp.rb:497:in
`getbinaryfile'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:600:in
`direct_open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:169:in `open_loop'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:164:in `catch'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:134:in `open_uri'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:424:in `open'
from h:/ruby/ruby_install/ruby/lib/ruby/1.8/open-uri.rb:85:in `open'
from simple_uri.rb:3
]Exit code: 1
RTFS'ing *cough* I find that open-uri does this:
[snip]
ftp = Net::FTP.open(self.host)
ftp.login(user, passwd)
# line 600 in open-uri
ftp.getbinaryfile(self.path, '/dev/null', Net::FTP:EFAULT_BLOCKSIZE)
[snap]
Docs for Net::FTP#getbinaryfile say:
--
getbinaryfile(remotefile, localfile = File.basename(remotefile),
blocksize = DEFAULT_BLOCKSIZE) {|data| ...}
Retrieves remotefile in binary mode, storing the result in localfile. If
a block is supplied, it is passed the retrieved data in blocksize chunks.
---
Since I am on Windows, there is no /dev/null to 'store' the file in.
any clues on what I am doing wrong?
regards,
Henrik