I am trying to reproduce the results of a research article which they provided the python codes. There is a script to download their data and I am trying to run the script from terminal by,
python getData.py
an it raises the error
File "getData.py", line 127, in dataFile = sys.argv[1]+"/raw-comp.txt" IndexError: list index out of range
Related part in the python code is here,
if __name__ == '__main__' :
dataFile = sys.argv[1]+"/raw-comp.txt"
# Read the data
I don't know if it is related or not; but 'getData.py' script is under 'src' folder whereas 'raw-comp.txt' file is under 'data' folder.
I check out this solution here, python : IndexError: list index out of range and it says argv
stores the command line arguments and you need to pass the arguments before calling it.
I also checked this out; from sys import argv - what is the function of "script" where script and filename were assigned to argv. But here in this code, argv was not defined before the code piece above, besides it is the first time argv is seen in the script.
I really have no idea why it did not run, because it supposed to work without any modifying they say. Thanks already.
Edit: They have provided the description below for the script, they do not mention any argument that has to be passed from terminal.
getData: a script to download and/or build the data files.