question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when running the code

See original GitHub issue

Hey, 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:open
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ThatXlinercommented, May 21, 2021

What I did was that I moved the example strategies folder outside of the folder prisonersDilemma.py was in (I actually renamed prisonersDilemma.py to __main__.py in a folder called “algch” so I can just run python -m algch to run the tournament)

1reaction
carykhcommented, May 21, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found