Page 1 of 1

ERROR: Python AI .. crashed - on Windows 10

Posted: Sat Feb 11, 2017 7:05 pm
by tacitus5
After a pause of more than one year I've downloaded and installed the newest (as far as I am informed) FreeOrion_v0.4.6_2016-09-16.49f9123_Win32_Setup.exe.

I'm using Windows 10 now.

An older version of FreeOrion ran fine on Windows 8.1 and exactly the same hardware I'm using now. (But I don't remember which version that was, must be 0.4.4. or maybe 0.4.5.)

Installation went fine, but when I start the game now on Windows 10 I always get one of the following Error messages after choosing "Single Player" -> "Galaxy Setup" - > "OK"

ERROR: Python AI for AI_1 crashed.
ERROR: Python AI for AI_3 crashed.
ERROR: Python AI for AI_5 crashed.

After that Windows closes the FreeOrion program.

Am I doing something wrong or can someone help me to make the program run again on Windows 10?

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Sat Feb 11, 2017 10:06 pm
by Geoff the Medio
Can you locate and post all of the .log files from immediately after trying to start a game and getting this issue?

On Windows, they should be located in: C:\Users\Username\AppData\Roaming\FreeOrion

Deleting everything in that folder before trying to start the game would be useful, to ensure there's no config issue and no stale log files accidentally included.

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Tue Feb 14, 2017 12:30 am
by tacitus5
Thanks for your answer.

I tried to delete all files in the said folder - that didn't change my problem.
After starting FreeOrion anew it crashed again

Here's the log file regarding that "AI" that crashed this time:
2017-02-14 01:16:11.836464 [debug] AI : Logger initialized
2017-02-14 01:16:11.836964 [debug] AI : v0.4.6 [build 2016-09-16.49f9123] MSVC 2013
2017-02-14 01:16:11.836964 [debug] AI : AI_6 ai client initialized.
2017-02-14 01:16:11.836964 [debug] AI : Attempting to contact server
2017-02-14 01:16:11.836964 [debug] AI : ClientNetworking::ConnectToServer : attempting to connect to server at 127.0.0.1
2017-02-14 01:16:11.836964 [debug] AI : tcp::resolver::iterator host_name: 127.0.0.1 address: 127.0.0.1 port: 12346
2017-02-14 01:16:11.838466 [debug] AI : ClientNetworking::ConnectToServer : connected to server
2017-02-14 01:16:11.838466 [debug] AI : ClientNetworking::ConnectToServer : this client using xml serialization.
2017-02-14 01:16:11.838466 [debug] AI : ClientNetworking::ConnectToServer : starting networking thread
2017-02-14 01:16:11.838466 [debug] AI : Initializing FreeOrion Python interface
2017-02-14 01:16:11.838466 [debug] AI : Python home set to D:\Program Files (x86)\FreeOrion
2017-02-14 01:16:11.838466 [debug] AI : Python program name set to D:\Program Files (x86)\FreeOrion\freeorionca.exe
2017-02-14 01:16:11.907031 [debug] AI : Python initialized
2017-02-14 01:16:11.907031 [debug] AI : Python version: 2.7.9 (default, Apr 18 2015, 13:30:31) [MSC v.1800 32 bit (Intel)]
2017-02-14 01:16:11.907031 [debug] AI : Python prefix: D:\Program Files (x86)\FreeOrion
2017-02-14 01:16:11.907031 [debug] AI : Python module search path: D:\Program Files (x86)\FreeOrion\python27.zip;D:\Program Files (x86)\FreeOrion\DLLs;D:\Program Files (x86)\FreeOrion\lib;D:\Program Files (x86)\FreeOrion\lib\plat-win;D:\Program Files (x86)\FreeOrion\lib\lib-tk;D:\Program Files (x86)\FreeOrion
2017-02-14 01:16:11.907031 [debug] AI : Initializing C++ interfaces for Python
2017-02-14 01:16:11.907031 [debug] AI : Initializing AI Python modules
2017-02-14 01:16:12.134749 [debug] AI : AI Python script path: D:/Program Files (x86)\FreeOrion\default\python\AI
2017-02-14 01:16:12.155770 [debug] AI : Python stdout and stderr redirected
2017-02-14 01:16:12.169783 [error] AI : AI Config: default file is not present and not writable at location C:\Users\Störmann\AppData\Roaming\FreeOrion\AI\default\config.ini
2017-02-14 01:16:12.170283 [error] AI : Traceback (most recent call last):
2017-02-14 01:16:12.170283 [error] AI : File "D:/Program Files (x86)\FreeOrion\default\python\AI\FreeOrionAI.py", line 12, in <module>
2017-02-14 01:16:12.170283 [error] AI : parse_config(fo.getAIConfigStr(), fo.getUserConfigDir())
2017-02-14 01:16:12.170283 [error] AI : File "D:\Program Files (x86)\FreeOrion\default/python\common\option_tools.py", line 113, in parse_config
2017-02-14 01:16:12.170783 [error] AI : config = _create_default_config_file(os.path.join(config_dir, CONFIG_DEFAULT_FILE))
2017-02-14 01:16:12.170783 [error] AI : File "D:\Program Files (x86)\FreeOrion\default/python\common\option_tools.py", line 75, in _create_default_config_file
2017-02-14 01:16:12.170783 [error] AI : with open(path, 'w') as configfile:
2017-02-14 01:16:12.170783 [error] AI : IOError: [Errno 2] No such file or directory: 'C:\\Users\\St\xc3\xb6rmann\\AppData\\Roaming\\FreeOrion\\config.ini'
2017-02-14 01:16:12.170783 [error] AI : AIClientApp.cpp:148 : AIClientApp failed due to error in python AI code for AI_6. Exiting Soon. id = -1
2017-02-14 01:16:12.281890 [debug] AI : ClientNetworking::NetworkingThread() : Networking thread will be terminated due to disconnect exception "Eine vorhandene Verbindung wurde vom Remotehost geschlossen"
2017-02-14 01:16:12.773797 [debug] AI : Shutting down AI_6 ai client.
2017-02-14 01:16:12.785309 [debug] AI : Cleaned up FreeOrion Python interface
2017-02-14 01:16:12.785808 [error] AI : camain.cpp:82 : main() caught exception(std::runtime_error): PythonAI failed to initialize.
The first problem sems to be

"default file is not present and not writable at location C:\Users\Störmann\AppData\Roaming\FreeOrion\AI\default\config.ini"

Since I didn't put the config.ini in that location, what can I do? Maybe it's a path parsing problem with the non-ASCII ("ö") characters ?

Help will be appreciated

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Tue Feb 14, 2017 1:13 am
by Geoff the Medio
Deleting the files wasn't meant to fix the issue, just to be sure you were posting fresh log files.

Looks like the code that writes the config file needs to be made tolerant to filesystem errors, and may need to do something to convert file path formats when on Windows before using what the API passed it for the config path.

After some testing and googling, Python 2 handing of non-ascii characters in pathes seems rather broken. This might be helpful: https://github.com/pypa/pip/pull/3970/files

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Tue Feb 14, 2017 9:47 am
by Vezzra
@tacitus5, can you install and try again with a recent test build? I think I remember that we already stumbled across this bug and we might have already fixed it, but I'm not sure.

Please report back if that solved the issue for you.

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Tue Feb 14, 2017 11:55 am
by Geoff the Medio
Vezzra wrote:I think I remember that we already stumbled across this bug and we might have already fixed it, but I'm not sure.
The relevant line at least looks promising: https://github.com/freeorion/freeorion/ ... ols.py#L75

Would probably still be good to have some error handling code in case that call fails, though.

Re: ERROR: Python AI .. crashed - on Windows 10

Posted: Tue Feb 14, 2017 10:36 pm
by tacitus5
Thanks a lot !
The latest test build runs fine and doesn't show the error messages.
Haven't played long enough to confirm that it is without any bugs, but so far everything goes smoothly.