i can`t get python working on the command line (linux)

Facundo Batista facundo at taniquetil.com.ar
Wed Mar 14 13:54:38 CET 2007


Mark wrote:


> and i`ve put it in tel.py (just the same as in the sample) than chmod
> it to 777 (just to make sure it isn`t a permission issue) and than i
> run it with: ./tel.py
> now this is the error that i get:
>
> Traceback (most recent call last):
>   File "./tel.py", line 12, in <module>
>     for line in open(argv[1], 'r').readlines():
> IndexError: list index out of range

Your Python is installed fine.

The problem is that you're accesing argv[1], which would be the first
argument after the program in the command line, and you're executing
your program without any parameters.

All you need to do is read the error message, they help, ;)

Try executing your program with something like

  ./tel.py myfile.txt

where, of course, myfile.txt is some file you have around...

Regards,

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/





More information about the Python-list mailing list