A team of us have worked on this for hours to no avail. If you clone https://github.com/sds-dubois/snake.ai onto a Mac and run it with Python 2.7 it works like a charm. When I try to do the same on Windows 10 with an Anaconda Python 2.7 environment, after installing pygame, numpy and sklearn, I get the following when I run $ python controller.py:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "controller.py", line 121, in <module>
    rl_hp = load_from(config.filename + ".p")
  File "C:\Users\mcram\Documents\Github\CS221-AI\MultiplayerSnake\snake-ai-slither\snake.ai\hp.py", line 46, in load_from
    out = pickle.load(fin)
  File "C:\Users\mcram\Anaconda3\envs\snake27\lib\pickle.py", line 1384, in load
    return Unpickler(file).load()
  File "C:\Users\mcram\Anaconda3\envs\snake27\lib\pickle.py", line 864, in load
  File "C:\Users\mcram\Anaconda3\envs\snake27\lib\pickle.py", line 1075, in load_inst
    klass = self.find_class(module, name)
  File "C:\Users\mcram\Anaconda3\envs\snake27\lib\pickle.py", line 1130, in find_class
ImportError: No module named hp

There is a file called hp.py and we can see that it is run (the 2nd call in the Traceback is File "C:\Users\mcram\Documents\Github\CS221-AI\MultiplayerSnake\snake-ai-slither\snake.ai\hp.py", line 46, in load_from which is from hp.py), so we're not understanding why I'm getting ImportError: No module named hp.

I tried multiple different Anaconda environments to no avail. Running from Spyder and PyCharm give the exact same result. Copying the entirely of hp.py into controller.py doesn't help. I also tried to 'hard code' the file path, with the different variations of slashes (e.g. forward, backward, double back, double forward), but that didn't work either. Any suggestions would be appreciated.

0 Answers