Help - Linux?

K

Knute Johnson

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 = line
i = i + 1
end
ftp.close
return metar
end

puts getMetar("KBFL")
 
A

Arlen Cuss

[Note: parts of this message were removed to make it a legal post.]
230 Login successful.
227 Entering Passive Mode (140,90,128,71,21,205)
=> ["2008/02/21 03:54", "KBFL 210354Z 00000KT 10SM CLR 09/06 A3005 RMK AO2
SLP176 T00890061"]
Works for me! :)

Arlen
 
K

Knute Johnson

Arlen said:
[Note: parts of this message were removed to make it a legal post.]
230 Login successful.
227 Entering Passive Mode (140,90,128,71,21,205)
=> ["2008/02/21 03:54", "KBFL 210354Z 00000KT 10SM CLR 09/06 A3005 RMK AO2
SLP176 T00890061"]

Works for me! :)

Arlen

Thanks very much, any ideas why it doesn't for me?
 
A

Arlen Cuss

[Note: parts of this message were removed to make it a legal post.]

Not a clue, I'm afraid. You'll need to dig deeper into what's happening on
the network, probably.

Cheers,
Arlen
 
M

M. Edward (Ed) Borasky

Knute said:
Arlen said:
[Note: parts of this message were removed to make it a legal post.]
getMetar("KBFL")
230 Login successful.
227 Entering Passive Mode (140,90,128,71,21,205)
=> ["2008/02/21 03:54", "KBFL 210354Z 00000KT 10SM CLR 09/06 A3005 RMK
AO2
SLP176 T00890061"]

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
 
R

Robert Citek

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 = 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,
- Robert
 
K

Knute Johnson

M. Edward (Ed) Borasky said:
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

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?
 
K

Knute Johnson

Robert said:
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 = 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,
- Robert


OK, so it's not a Linux problem it's my Linux problem.
 
L

Leslie Viljoen

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
 
K

Knute Johnson

Leslie said:
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

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,
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top