First off, great work and a fun game. During multiplayer game between a human and one AI, I observed AI not exploring, colonizing, etc. AI doesn't seem to work in single player either, but I can't run as observer to verify it's nonfunctional during the game.
The AI log from the multiplayer game showed a namespace error after running the PythonAI file:
2011-08-02 21:36:04,318 DEBUG AI : Initializing C++ interfaces for Python
2011-08-02 21:36:06,026 ERROR AI : Unable to set up main namespace in Python.
I'm running OSX 10.6.8 on a 2.8GHz iMac. I have python 2.6.1 installed, but the game defaults to using Python version 2.5.5 that is included with the OSX FreeOrion v0.3.16 binary.
The python modules are present in the expected directories (i.e. inside /Applications/FreeOrion.app/Contents/Frameworks/Python.framework/Versions/Current) on my iMac.
The AI python script files are present inside /Applications/FreeOrion.app/Contents/Resources/default/AI directory, too.
Couldn't find any similar Python problem in the forums, just the old "capitolID" vs "HomeworldID" bug inside the ExplorationAI.py file, but that looks fixed with v0.3.16.
v0.3.16 (SVN 4046) Python error with OSX
Moderator: Oberlus
v0.3.16 (SVN 4046) Python error with OSX
- Attachments
-
- AI_1.log.zip
- Here is the zipped log file for AI_1.log
- (22.9 KiB) Downloaded 49 times
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: v0.3.16 (SVN 4046) Python error with OSX
Hmm... odd. I don't recall seeing this problem before either. Unfortunately, I neglected to print the Python error text for that particular instruction, so debugging this will be quite difficult. The problem is fairly fundamental though, as the __main__ namespace is always supposed to exist.
Could you try deleting all the Python 2.5.5 stuff from the FreeOrion directory? Maybe that will force it to use 2.6 and it will magically start working?
Could you try deleting all the Python 2.5.5 stuff from the FreeOrion directory? Maybe that will force it to use 2.6 and it will magically start working?
Re: v0.3.16 (SVN 4046) Python error with OSX
Instead of deleting the 2.5 folder, I think I'll try editing the symbolic links that point it to the 2.5 directory and instead point to the directory structure where I have 2.6.
Specifically, in the /Applications/FreeOrion.app/Contents/Frameworks/Python.framework there are three symbolic links:
Headers -> Versions/Current/Headers
Python -> Versions/Current/Python
Resources -> Versions/Current/Resources
I figured I could change these 3 sym links and point them to:
/System/Library/Frameworks/Python.framework/Versions/Current/Headers
/System/Library/Frameworks/Python.framework/Versions/Current/Resources
/System/Library/Frameworks/Python.framework/Versions/Current/Python
Will let you know how it goes.
Specifically, in the /Applications/FreeOrion.app/Contents/Frameworks/Python.framework there are three symbolic links:
Headers -> Versions/Current/Headers
Python -> Versions/Current/Python
Resources -> Versions/Current/Resources
I figured I could change these 3 sym links and point them to:
/System/Library/Frameworks/Python.framework/Versions/Current/Headers
/System/Library/Frameworks/Python.framework/Versions/Current/Resources
/System/Library/Frameworks/Python.framework/Versions/Current/Python
Will let you know how it goes.
Re: v0.3.16 (SVN 4046) Python error with OSX
What I just found out is you can do this: First, remove the following symlink:Quercus wrote:Instead of deleting the 2.5 folder, I think I'll try editing the symbolic links that point it to the 2.5 directory and instead point to the directory structure where I have 2.6.
Specifically, in the /Applications/FreeOrion.app/Contents/Frameworks/Python.framework there are three symbolic links:
Headers -> Versions/Current/Headers
Python -> Versions/Current/Python
Resources -> Versions/Current/Resources
I figured I could change these 3 sym links and point them to:
/System/Library/Frameworks/Python.framework/Versions/Current/Headers
/System/Library/Frameworks/Python.framework/Versions/Current/Resources
/System/Library/Frameworks/Python.framework/Versions/Current/Python
Will let you know how it goes.
/Applications/FreeOrion.app/Contents/Frameworks/Python.framework/Versions/Current
and point it instead to this link:
/System/Library/Frameworks/Python.framework/Versions/Current
It does essentially the same thing you were doing, but with less typing.
Also, it did in fact take care of the python error, and on top of that, the AI seems to be somewhat productive now as opposed to just sitting there.
Re: v0.3.16 (SVN 4046) Python error with OSX
In the end I edited the 3 sym links and deleted the existing Python 2.5.5 files (per Geoff's recommendation) that ship with the binary. Still had an error in the AI log file, though, because it couldn't find the modules in the 2.6 directories.
Had to create a link to /System/Library/Frameworks/Python.framework/Versions/Current
That did the trick, and the AI was off and running, exploring, etc.
Had to create a link to /System/Library/Frameworks/Python.framework/Versions/Current
That did the trick, and the AI was off and running, exploring, etc.
Re: v0.3.16 (SVN 4046) Python error with OSX
I updated* the built-in Python framework to 2.7.1 in my latest build/SDK over here. Could you please test it and tell me if it's working out of the box?
*just copied the files from my /System/Library/Frameworks/Python.framework
*just copied the files from my /System/Library/Frameworks/Python.framework
Re: v0.3.16 (SVN 4046) Python error with OSX
Got the AI scripts running on my macbook pro, but I found there were errors in the AI log when running FO on my iMac even though both computers were running OSX 10.6.8 and had Python 2.6 installed. The Python 2.6 installations were very different.
Inexplicably, the Python 2.6 install on the iMac had only one file in the /System/Library/Frameworks/Python.framework/Versions/Current/include/python2.6 directory. There were 88 files in that same directory on the laptop.
Also, there was no Header sym link inside /System/Library/Frameworks/Python.framework/Versions/Current. It's supposed to be there and pointing at /include/python2.6
I copied the include files from the laptop to the iMac and created the missing symbolic links. Now the AI on the iMac seems to work properly- no ERROR messages in the AI log files.
Inexplicably, the Python 2.6 install on the iMac had only one file in the /System/Library/Frameworks/Python.framework/Versions/Current/include/python2.6 directory. There were 88 files in that same directory on the laptop.
Also, there was no Header sym link inside /System/Library/Frameworks/Python.framework/Versions/Current. It's supposed to be there and pointing at /include/python2.6
I copied the include files from the laptop to the iMac and created the missing symbolic links. Now the AI on the iMac seems to work properly- no ERROR messages in the AI log files.
Re: v0.3.16 (SVN 4046) Python error with OSX
Have you tried the new build I posted? It should run without any changes, since Python 2.7.1 is included in the FreeOrion app bundle now.