seblau / BlackJack-Simulator

BlackJack-Simulator written in Python with OMEGA II Count
171 stars 97 forks source link

Index error #9

Open nevadarain opened 6 years ago

nevadarain commented 6 years ago

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.

djl314 commented 3 years ago

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')