[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

issue with uninitialized constant ARG (NameError

Tuka Opaleye

3/29/2008 6:53:00 PM

Hi,

I have a really wierd issue going on with command line on windows:

I have 2 files

C:\Data\Projects\Ruby\tests>ruby ParseTest.rb source.csv
source.csv
target.au3

C:\Data\Projects\Ruby\tests>ruby StringTest.rb source.csv
StringTest.rb:12: uninitialized constant ARG (NameError)

ParseTest.rb contains:

# Parsing Test - Ruby CB 21.3
#puts 'This program will output the command line arguments word by word'
#ARGV.each {|line| puts line}
puts ARGV[0]
puts ARGV[1]

-----------------------------------------

StringTest.rb contains:

# the first commandline argument is the source file
# the 2nd argument is the target file

puts ARGV[0]
puts ARGV[1]

#Get the arguments and assign as files
sourceFilename = ARGV[0]
targetFilename = ARGV[1]


What is the issue here ? Seems more todo with the environment...

TIA,
Tuka
--
Posted via http://www.ruby-....

2 Answers

Sebastian Hungerecker

3/29/2008 6:58:00 PM

0

Tuka Opaleye wrote:
> C:\Data\Projects\Ruby\tests>ruby StringTest.rb source.csv
> StringTest.rb:12: uninitialized constant ARG (NameError)
> [...]
> StringTest.rb contains:
>
> # the first commandline argument is the source file
> # the 2nd argument is the target file
>
> puts ARGV[0]
> puts ARGV[1]
>
> #Get the arguments and assign as files
> sourceFilename = ARGV[0]
> targetFilename = ARGV[1]

Did you copy and paste that? Because the error message complains about ARG,
but there's only ARG*V* in the code - which doesn't make any sense...


--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Tuka Opaleye

3/29/2008 11:42:00 PM

0

Thanks Sebastian,

That is what I needed. My Bad and some confusion with the editor I am
using... I was editing a similarly named file elsewhere and running the
errant file yielding the same bad result.

Thanks again,
Tuka

Sebastian Hungerecker wrote:
> Tuka Opaleye wrote:
>>
>> #Get the arguments and assign as files
>> sourceFilename = ARGV[0]
>> targetFilename = ARGV[1]
>
> Did you copy and paste that? Because the error message complains about
> ARG,
> but there's only ARG*V* in the code - which doesn't make any sense...

--
Posted via http://www.ruby-....