Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index error #9

Open
nevadarain opened this issue Jul 21, 2018 · 1 comment
Open

Index error #9

nevadarain opened this issue Jul 21, 2018 · 1 comment

Comments

@nevadarain
Copy link

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
Copy link

djl314 commented Feb 23, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants