Working with Text Data | scikit-learn | From Occurrences to Frequencies Documentation

Hello everyone,
I was going through the scikit documentation given in the exercises. (Working With Text Data — scikit-learn 0.24.2 documentation) I went through all the tutorials without a glitch and finished the first challenge by opening the exercise_01_language_train_model.py file with jupyter notebook. I finished the exercise and at this point, it is almost identical to the solution. When I run it using Powershell I get this error message: line 23, in
languages_data_folder = sys.argv[1]
IndexError: list index out of range. I don’t understand why I get an index error at this point. I get the same error when I run the solutions file, so it looks like the problem is not the code itself. Do you have any idea why I might be getting an index error with sys.argv[1]?
Thanks

sys.argv is normally used for arguments passed to a python script from the command line, for example-
python script.py arg1 arg2

In this situation the sys.argv[0] is the name of the script itself, “script.py” here, with further elements being the arguments you passed in: sys.argv[1] == arg1 and sys.argv[2] == arg2.

There seems to be a line in your code that expected arguments to be passed when this script was invoked… but the list index out of range suggests no arguments were passed so sys.argv only contains a single element.

Without more detail it’s hard to say for certain but the first check would be making sure you pass any arguments that your script expects.