Would somebody please try this on Linux for me. It works fine on
Windows but hangs on Fedora.
Thanks,
#!/usr/bin/ruby
require ‘net/ftp’
def getMetar(id)
metar = Array.new
i = 0
ftp = Net::FTP.new(‘tgftp.nws.noaa.gov’)
puts ftp.login
puts ftp.sendcmd(‘PASV’)
ftp.chdir(‘/data/observations/metar/stations’)
ftp.gettextfile(“#{id.upcase}.TXT”) do |line|
metar[i] = line
i = i + 1
end
ftp.close
return metar
end
puts getMetar(“KBFL”)
–
Knute Johnson
email s/nospam/knute/
Arlen C. wrote:
Arlen
Thanks very much, any ideas why it doesn’t for me?
–
Knute Johnson
email s/nospam/knute/
Not a clue, I’m afraid. You’ll need to dig deeper into what’s happening
on
the network, probably.
Cheers,
Arlen
Knute Johnson wrote:
Works for me! 
Arlen
Thanks very much, any ideas why it doesn’t for me?
Step one: install a command line FTP client. I use “lftp”, but there are
others. Then type
lftp tgftp.nws.noaa.gov
lftp tgftp.nws.noaa.gov:~>
If you don’t get that prompt, there’s something disconnected between
your client and the server. You’ll need to talk to your network
adminstrator to diagnose what’s broken.
But if you do get the prompt, the network is working but the Ruby
client isn’t. There’s probably something wrong with your Ruby
installation. Reinstall Ruby. Try again
On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson
[email protected] wrote:
Would somebody please try this on Linux for me. It works fine on
Windows but hangs on Fedora.
I ran this script:
true && (
set -x
cat /etc/issue.net
ruby -v
cat ftp.rb
./ftp.rb
) >& output.txt
Here’s the content of output.txt:
$ cat output.txt
- cat /etc/issue.net
Ubuntu 7.10
- ruby -v
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
- cat ftp.rb
#!/usr/bin/ruby
require ‘net/ftp’
def getMetar(id)
metar = Array.new
i = 0
ftp = Net::FTP.new(‘tgftp.nws.noaa.gov’)
puts ftp.login
puts ftp.sendcmd(‘PASV’)
ftp.chdir(‘/data/observations/metar/stations’)
ftp.gettextfile(“#{id.upcase}.TXT”) do |line|
metar[i] = line
i = i + 1
end
ftp.close
return metar
end
puts getMetar(“KBFL”)
- ./ftp.rb
230 Login successful.
227 Entering Passive Mode (140,90,128,71,211,81)
2008/02/21 04:54
KBFL 210454Z 00000KT 10SM CLR 08/06 A3006 RMK AO2 SLP179 T00830061
Regards,
M. Edward (Ed) Borasky wrote:
your client and the server. You’ll need to talk to your network
adminstrator to diagnose what’s broken.
But if you do get the prompt, the network is working but the Ruby
client isn’t. There’s probably something wrong with your Ruby
installation. Reinstall Ruby. Try again
The command line client works just fine. I removed and reinstalled ruby
and the problem still exists. Is there some library I have to install
too for the FTP class?
–
Knute Johnson
email s/nospam/knute/
On Thu, Feb 21, 2008 at 7:59 AM, Knute Johnson
[email protected] wrote:
Robert C. wrote:
On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson
[email protected] wrote:
Would somebody please try this on Linux for me. It works fine on
Windows but hangs on Fedora.
You might want to “gem install ruby-debug”, put this at the top of your
program:
require ‘ruby-debug’
Debugger.start
debugger #start irb
…and then use “s” to step through each line and see exactly
where the hang-up is. Might be a threading issue.
Les
Robert C. wrote:
ruby -v
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
puts ftp.sendcmd(‘PASV’)
- ./ftp.rb
230 Login successful.
227 Entering Passive Mode (140,90,128,71,211,81)
2008/02/21 04:54
KBFL 210454Z 00000KT 10SM CLR 08/06 A3006 RMK AO2 SLP179 T00830061
Regards,
OK, so it’s not a Linux problem it’s my Linux problem.
–
Knute Johnson
email s/nospam/knute/
Leslie V. wrote:
require ‘ruby-debug’
Debugger.start
debugger #start irb
…and then use “s” to step through each line and see exactly
where the hang-up is. Might be a threading issue.
Les
Les:
I tried this but get the following error
metar.rb:6:in `require’: no such file to load – ruby-debug (LoadError)
from metar.rb:6
There is no ruby-debug package that I can find for Fedora. I tried
loading rubygems.noarch but that didn’t help. There has to be something
simple I’m missing here, I just don’t know what it is.
Thanks,
–
Knute Johnson
email s/nospam/knute/