BlackJack-Simulator icon indicating copy to clipboard operation
BlackJack-Simulator copied to clipboard

Index error

Open nevadarain opened this issue 6 years ago • 1 comments

Hello I am having an issue when running this code. I downloaded the folder and I moved the importer folder only to my sites packages folder within my python folder. I successfully pip installed the importer folder. I successfully imported strategy importer with no errors "import importer.StrategyImporter as StrategyImporter". When running the program i get an index error. "Traceback (most recent call last): File "C:\Users\Rashad Powell\workspace\MyTutorial\BlackJack_Simulation.py", line 470, in importer = StrategyImporter(sys.argv[1]) IndexError: list index out of range

I am using eclipse IDE. Your help will be much appreciated. Thank you.

nevadarain avatar Jul 21 '18 21:07 nevadarain

This is the expected behavior, the sys object receives arguments when calling the script from the command line. sys.argv[1] is the first argument passed - it should be the name/path to the Strategy.csv file. EX: python blackjack_sim.py strategy.csv (assumes csv file in same directory as py file.)

In the alternativve, if you are running from within editor, you can remove the argv[1] and just hard code the file name/path: EX: importer = StrategyImporter('BS.csv')

djl314 avatar Feb 23 '21 04:02 djl314