net/sftp 1.10 errors

Z

zdennis

I recently downloaded net/ssh 1.0.7 and net/sftp 1.1.0. But I get problems with ruby 1.8.2, 1.8.3 on
either windows, debian or ubuntu boxes.

require 'rubygems'
require 'net/sftp'

sftp_sess = Net::SFTP.start 'host', 'username', 'password'
sftp_sess.put_file '/home/uberriffic/test.txt', '/home/uberriffic/remote_test.txt'
NoMethodError: private method `open' called for #<Net::SFTP::protocol::Driver:0xb7863790>
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/protocol/driver.rb:201:in
`method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/operations/open.rb:27:in `perform'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/operations/abstract.rb:64:in
`execute'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:253:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:177:in `open_handle'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/sftp/session.rb:203:in `put_file'
from (irb):4
from :0

Do I need ruby 1.8.4? Thanks

Zach
 
J

Jamis Buck

I recently downloaded net/ssh 1.0.7 and net/sftp 1.1.0. But I get
problems with ruby 1.8.2, 1.8.3 on either windows, debian or ubuntu
boxes.

require 'rubygems'
require 'net/sftp'

sftp_sess = Net::SFTP.start 'host', 'username', 'password'
sftp_sess.put_file '/home/uberriffic/test.txt', '/home/uberriffic/
remote_test.txt'
NoMethodError: private method `open' called for
#<Net::SFTP::protocol::Driver:0xb7863790>
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/protocol/driver.rb:201:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/operations/open.rb:27:in `perform'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/operations/abstract.rb:64:in `execute'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:253:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:177:in `open_handle'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:203:in `put_file'
from (irb):4
from :0

Do I need ruby 1.8.4? Thanks

Zach

Zach,

Thanks for this report. I'm not sure yet what's going wrong here, but
I can duplicate the error on my machine and I'll look into it.

- Jamis
 
J

Jamis Buck

I recently downloaded net/ssh 1.0.7 and net/sftp 1.1.0. But I get
problems with ruby 1.8.2, 1.8.3 on either windows, debian or ubuntu
boxes.

require 'rubygems'
require 'net/sftp'

sftp_sess = Net::SFTP.start 'host', 'username', 'password'
sftp_sess.put_file '/home/uberriffic/test.txt', '/home/uberriffic/
remote_test.txt'
NoMethodError: private method `open' called for
#<Net::SFTP::protocol::Driver:0xb7863790>
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/protocol/driver.rb:201:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/operations/open.rb:27:in `perform'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/operations/abstract.rb:64:in `execute'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:253:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:177:in `open_handle'
from /usr/lib/ruby/gems/1.8/gems/net-sftp-1.1.0/lib/net/
sftp/session.rb:203:in `put_file'
from (irb):4
from :0

Here are two workarounds:

First, you can use a block to Net::SFTP.start:

Net::SFTP.start(...) do |sess|
sess.put_file(...)
end

Or, if you can't use the block format for whatever reason, be sure to
call #connect after calling start:

sess = Net::SFTP.start(...)
sess.connect
sess.put_file(...)

Not sure why that connect isn't being called automatically, but I'll
look into it.

- Jamis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top