Janzert / AEI

The Arimaa Engine Interface provides a standard method to communicate and control an Arimaa bot.
http://arimaa.janzert.com/aei/
Other
22 stars 5 forks source link

imports fail after scripts were moved to pyrimaa (master) #4

Closed arhart closed 9 years ago

arhart commented 9 years ago

I'm using python 2.6.6 on debian. Attempting to run the scripts on master leads to import errors. For example: arhart@debian:~/arimaa/AEI$ ./pyrimaa/gameroom.py Traceback (most recent call last): File "./pyrimaa/gameroom.py", line 56, in from pyrimaa import aei ImportError: No module named pyrimaa

Am I running the correct command? Do I need to do something with setup.py (if so, what)? I can go through and adjust the imports to not reference pyrimaa, but I'm wondering if I'm not running the scripts as intended.

Attempting to use a link from the current directory results in the same error: arhart@debian:~/arimaa/AEI$ ls -l ./gameroom.py lrwxrwxrwx 1 arhart arhart 19 Dec 26 21:56 ./gameroom.py -> pyrimaa/gameroom.py arhart@debian:~/arimaa/AEI$ ./gameroom.py Traceback (most recent call last): File "./gameroom.py", line 56, in from pyrimaa import aei ImportError: No module named pyrimaa

Janzert commented 9 years ago

Sorry, I haven't written any installation documentation for the new layout yet.

The pyrimaa package needs to end up on the PYTHONPATH somehow. The intended way for this to happen is for AEI to be installed with setup.py using something like "python setup.py install". You will need setuptools installed first "sudo apt-get install setuptools".

One gotcha though is you probably don't really want it installed into the system python directories (which would also require root). If you use python for lots of different projects I'd recommend setting up a virtualenv for it.

But the easiest thing to do is a user install with "python setup.py install --user" run from the AEI directory. This will install to "~/.local". Python automatically has ~/.local/lib/blah in it's pythonpath so the scripts will work. Also if you add ~/.local/bin to your shell path then you can run the scripts using "gameroom", "analyze", etc..

arhart commented 9 years ago

Thanks. It turns out setuptools doesn't pass command-line arguments to entry points, so "gameroom" doesn't work, but my symlink ./gameroom.py can now find the pyrimaa module.

Janzert commented 9 years ago

Oops, thanks. Should be fixed now.