ERROR: Python AI for AI_1 crashed

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
Arbi
Space Krill
Posts: 3
Joined: Sat Sep 24, 2016 10:17 am

ERROR: Python AI for AI_1 crashed

#1 Post by Arbi »

Hello everybody,

when I try to start a new single player match it crashes with the error message "ERROR: Python AI for AI_1 crashed." What am I doing wrong or can adjust?

FO-Version: FreeOrion_v0.4.6_2016-09-16.49f9123_Win32_Setup
OS: Win 10

Thank you in advance

PS. sorry for my bad english!

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: ERROR: Python AI for AI_1 crashed

#2 Post by Vezzra »

As an important first source of information we need the log files FO created on your system. See here for instructions where the log files can be found on your system.

To be safe provide all the log files you find in there, freeorion.log, freeoriond.log and all the AI_XX.log files.

Arbi
Space Krill
Posts: 3
Joined: Sat Sep 24, 2016 10:17 am

Re: ERROR: Python AI for AI_1 crashed

#3 Post by Arbi »

During this game I had only one AI. So there is only one respective log-file. But the error occurres also with multiple AI-players.
Attachments
freeoriond.log
(3.68 KiB) Downloaded 128 times
AI_1.log
(3.71 KiB) Downloaded 144 times
freeorion.log
(8.77 KiB) Downloaded 129 times

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: ERROR: Python AI for AI_1 crashed

#4 Post by Vezzra »

Hm, the issue is quite obvious, according to this line in the AI error log:

Code: Select all

19:15:50.633145 [error] AI : AI Config: default file is not present and not writable at location C:\Users\Benjamin Schäfer\AppData\Roaming\FreeOrion\AI\default\config.ini
2016-09-24 
...the AI process fails to create a required config file in your AppData directory tree. My first guess is that the special character "ä" in your user name might cause the issue - although I thought we caught all the locations where special characters in file paths caused problems.

Can you try and create an additional user on your system, with a username without any special characters, and try to launch a game under this new account?

If that doesn't fix it, there must be something amiss with the access permissions in you user profile directory. That folder should be writeable...

Arbi
Space Krill
Posts: 3
Joined: Sat Sep 24, 2016 10:17 am

Re: ERROR: Python AI for AI_1 crashed

#5 Post by Arbi »

Thank you very much!

Creating a new user without the character "ä" works. There was no error anymore.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: ERROR: Python AI for AI_1 crashed

#6 Post by adrian_broher »

Vezzra wrote:

Code: Select all

19:15:50.633145 [error] AI : AI Config: default file is not present and not writable at location C:\Users\Benjamin Schäfer\AppData\Roaming\FreeOrion\AI\default\config.ini
2016-09-24 
If you take a look into the stack trace you will see:

Code: Select all

C:\\Users\\Benjamin Sch\xc3\xa4fer\\AppData\\Roaming\\FreeOrion\\config.ini
That means the string data IS utf-8 encoded (\xc1\xa4 is the byte sequence of an utf-8 encoded ä) but is not recognized as a python unicode string but handed over as, well, Python terminology calls it string but it's just a byte sequence with no determined encoding. Problem here is that windows uses utf-16le as file path encoding where the ä is represented by \x00\xe4 so there is no match between those pathes when comparing them as dumb byte sequences. This problem doesn't occur on Mac or Linux because the file pathes are dumb byte sequences that happen to be encoded as utf-8.

The python open function determines if the path should be handed over to the operating system as dumb byte sequence or converted to the native filesystem encoding by passing either a python unicode string or a regular python string as path. We do the latter and should do the former. So adding something like

Code: Select all

f = open(unicode(path, 'utf-8'), 'r') // convert path to a unicode object and 
should do the trick for now.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
EricF
Space Dragon
Posts: 357
Joined: Fri Jul 29, 2016 10:12 am

Re: ERROR: Python AI for AI_1 crashed

#7 Post by EricF »


User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: ERROR: Python AI for AI_1 crashed

#8 Post by adrian_broher »

xkcd, one of the most unfunny net content I ever came across.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: ERROR: Python AI for AI_1 crashed

#9 Post by adrian_broher »

Should be fixed with 737d4a3c.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Post Reply