issue with uninitialized constant ARG (NameError)

T

Tuka Opaleye

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
 
S

Sebastian Hungerecker

Tuka said:
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...
 
T

Tuka Opaleye

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 said:
Tuka said:
#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...
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top