sys.argv not found

Steve Holden sholden at holdenweb.com
Wed Jul 18 10:51:18 EDT 2001


"Man Vehicle Laboratory" <FenZhao at mit.edu> wrote in message
news:3B55962C.63F7E2EF at mit.edu...
> Hi all,
>
> I'm writing a python program that uses VRUT (OpenGL application), but I
> seem to lose the sys.argv list whenever I run VRUT.  For example,
> vrut.go() starts VRUT.  I call it after I ask for sys.argv, but somehow
> it begins to run and in the display window gives an AttributeError for
> argv.
>
> I'm not quite understanding the logic of the order python is doing (why
> it would call the vrut command before the sys.argv).  I tried wrapping
> the vrut.go in a function, and calling that function instead to no
> avail- same problem.  Sending in the wrong number of arguments however
> will generate an "IndexError: list index out of range".
>
>                   --Fen Zhao
>
>
> mode=string.atoi(sys.argv[1])
> ARGFILE_stim=sys.argv[2]
> ARGFILE_calib=sys.argv[3]
> OUTFILE=sys.argv[4]
> SUMFILE=sys.argv[5]
> sidOutfile=sys.argv[6]
> VECTION_DURATION=string.atoi(sys.argv[7])
> path=sys.argv[8]
> ...
>
> vrut.go(vrut.NICE)
>
First, can we assume you have included an "import sys" above the code you
quote?

You should:

a) Make sure you incude the exact error traceback with postings like this,
so we can see more nearly where the problem might be occurring; and

b) Scatter "print" statements to give you confidence that your logic is
indeed being executed as you expect, in the sequence you expect.

I have an idea that vrut.go() might be looking at sys.argv itself, but there
isn't really sufficient data to *know* quite what's going wrong. Your
assumptions appear reasonable, but I think your code *is* being executed in
the order you expect.

Good luck
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list