[Tutor] pass arg to list

Anirudh Tamsekar anirudh.tamsekar at gmail.com
Thu Jul 18 14:34:09 EDT 2019


Hi,


I'm trying to pass arguments to list.

This script needs to generate csv files. I want to pass the version and
build number to the script and it should be passed to the list.

My script below is blowing index out of range after adding the args.
However, if I hardcode the version, it works fine.
Kindly advise.



# User Args

version = sys.argv[1]

build = sys.argv[2]





add_file = (

    ['AddFile',

     109102010,

     'Product-'+version + 'Package (Build' + build + ')',

     'Product-'+version+'-b'+build+'-package.pkg',

     'Product-'+version + 'Service Package (Build' + build +  ')',

     version,

     ''],

)







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



Process finished with exit code 1



-Thanks,

Anirudh Tamsekar


More information about the Tutor mailing list