Error when running the code
See original GitHub issueHey, I’m relativly new to python and I didn’t find anything on this when googling. So when I tried running the code I got this errormessage:
Starting tournament, reading files from exampleStrats
Traceback (most recent call last):
File "C:/Users/bblom/PycharmProjects/PrisonersDilemmaTournament/code/prisonersDilemma.py", line 120, in <module>
runFullPairingTournament(STRATEGY_FOLDER, RESULTS_FILE)
File "C:/Users/bblom/PycharmProjects/PrisonersDilemmaTournament/code/prisonersDilemma.py", line 97, in runFullPairingTournament
roundHistory = runRound(pair)
File "C:/Users/bblom/PycharmProjects/PrisonersDilemmaTournament/code/prisonersDilemma.py", line 39, in runRound
moduleA = importlib.import_module(STRATEGY_FOLDER+"."+pair[0])
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named exampleStrats.alwaysCooperate
It doesn’t seem to be related to any of my code so I was wondering what caused it and how I would be able to fix it. I’m using Python 3.9 on Windows with PyCharm.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Fix program errors and improve code - Visual Studio (Windows)
This article describes some basic ways Visual Studio can help you find and fix problems in your code, including build errors, code analysis, ......
Read more >Python code running in VS Code terminal but throwing error in ...
I'm trying to run a simple Python code in VS Code that runs successfully in the terminal but throws an error in the...
Read more >Code keeps running without any error but no result ,please help!
I use the function in the script by calling it. Now, I have a problem and the problem is when I run the...
Read more >How to Fix 'Terminated With Exit Code 1' Error - Komodor
An application error is a programming error in any code running within the container. For example, if a Java library is running within...
Read more >Error running Python config routine - Error code: 2
... error may present at the end of the "Run Installer" step for Tableau Server 2021.4: Error running Python config routine - Error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What I did was that I moved the example strategies folder outside of the folder
prisonersDilemma.py
was in (I actually renamedprisonersDilemma.py
to__main__.py
in a folder called “algch” so I can just runpython -m algch
to run the tournament)oh shoot, I’m not sure why that’s happening for you! Yeah, for me, I do have to be in the ‘/code’ folder before running the code to get it to run, but I’ve never run into the errors you guys are getting. I hope @hand-burger 's solution works for others as well