Help - Linux?

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/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

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! :slight_smile:

Arlen

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

···

On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson <nospam@rabbitbrush.frazmtn.com> wrote:

Would somebody please try this on Linux for me. It works fine on
Windows but hangs on Fedora.

Arlen Cuss wrote:

[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! :slight_smile:

Arlen

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

···

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

Robert Citek wrote:

···

On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson > <nospam@rabbitbrush.frazmtn.com> 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,
- Robert

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

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

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:

Arlen Cuss wrote:

[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! :slight_smile:

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

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

···

On Thu, Feb 21, 2008 at 7:59 AM, Knute Johnson <nospam@rabbitbrush.frazmtn.com> wrote:

Robert Citek wrote:
> On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson > > <nospam@rabbitbrush.frazmtn.com> wrote:
>> Would somebody please try this on Linux for me. It works fine on
>> Windows but hangs on Fedora.

M. Edward (Ed) Borasky wrote:

Knute Johnson wrote:

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

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/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

Leslie Viljoen wrote:

Robert Citek 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

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,

···

On Thu, Feb 21, 2008 at 7:59 AM, Knute Johnson > <nospam@rabbitbrush.frazmtn.com> wrote:

> On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson >> > <nospam@rabbitbrush.frazmtn.com> wrote:

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

> You might want to "gem install ruby-debug", put this at the
top of your
> program:
>

require 'rubygems'

···

> require 'ruby-debug'
> Debugger.start
> debugger #start irb
>

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