1. v. The act of writing a weblog or 2. n. Toby’s weblog.

ruby net-sftp uninitialized constant

I’m currently writing some code that fetches a file from an sftp server. Using ruby 1.8.7 / net-sftp 2.0.4 the following code triggers an exception:

Net::SFTP.start( sftpHost, sftpUser, :password => sftpPass ) do |sftp|
  $stderr.puts "Downloading: #{sftpPath}#{sftpFile}"
  xml =!( "#{sftpPath}#{sftpFile}" )

The exception is:

/usr/lib64/ruby/gems/1.8/gems/net-sftp-2.0.4/lib/net/sftp/session.rb:123:in `download!': uninitialized constant Net::SFTP::Session::StringIO (NameError)

The solution is to add:

require 'stringio'

to the top of the session.rb file mentioned in the exception message.

Update: 2010-08-19 16:00 I’ve just heard back from the developer having emailed him this blog entry. He is hopefully pushing a fix this evening. Now that’s service!

Update: 2010-08-20 Last night version 2.0.5 was released which has the fix in it.

Published on 2010/08/19 at 14:25 by Toby, tags , , , ,

If you liked this article you can add me to Twitter

comment ruby net-sftp uninitialized constant

Powered by Publify – Thème Frédéric de Villamil | Photo Glenn