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. For problems building from source, post in Compile.
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 » Sat Sep 24, 2016 10:32 am

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: 4674
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: ERROR: Python AI for AI_1 crashed

#2 Post by Vezzra » Sun Sep 25, 2016 1:59 pm

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 » Sun Sep 25, 2016 2:12 pm

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 31 times
AI_1.log
(3.71 KiB) Downloaded 33 times
freeorion.log
(8.77 KiB) Downloaded 29 times

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

Re: ERROR: Python AI for AI_1 crashed

#4 Post by Vezzra » Sun Sep 25, 2016 2:52 pm

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 » Sat Oct 01, 2016 7:53 am

Thank you very much!

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

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

Re: ERROR: Python AI for AI_1 crashed

#6 Post by adrian_broher » Sat Oct 01, 2016 11:25 am

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: 282
Joined: Fri Jul 29, 2016 10:12 am

Re: ERROR: Python AI for AI_1 crashed

#7 Post by EricF » Sat Oct 01, 2016 12:21 pm


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

Re: ERROR: Python AI for AI_1 crashed

#8 Post by adrian_broher » Sat Oct 01, 2016 1:19 pm

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: 1072
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: ERROR: Python AI for AI_1 crashed

#9 Post by adrian_broher » Sat Oct 01, 2016 2:23 pm

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

Post Reply