[Tutor] pass arg to list
Alan Gauld
alan.gauld at yahoo.co.uk
Thu Jul 18 14:47:42 EDT 2019
On 18/07/2019 19:34, Anirudh Tamsekar wrote:
> # User Args
>
> version = sys.argv[1]
> build = sys.argv[2]
>
> add_file = (...
> )
> Traceback (most recent call last):
>
> File "/Users/atamsekar/Projects/PulseSO/trunk/swrelease/samplexls.py",
> line 5, in <module>
>
> version = sys.argv[1]
>
> IndexError: list index out of range
The obvious thing to do is add a print statement before the asignments
print(sys.argv)
and check that it contains your expected values.
If that doesn't help show us your full code (including import
statements) and your full execution output, including whree you
call the program.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list