Python's stderr is redirected to a file pyerr.txt...

...made the python script execute even if pyerr.txt cannot be written to.
This commit is contained in:
Elias Pschernig 2008-04-28 14:53:26 +00:00
parent 1f5f895571
commit cf449290cb

View file

@ -1967,7 +1967,10 @@ void python_ai::play_turn()
"err = \"unknown error\"\n"
"try:\n"
"\timport sys, traceback\n"
"\tsys.stderr = file(\"pyerr.txt\", \"wb\")\n"
"\ttry:\n"
"\t\tsys.stderr = file(\"pyerr.txt\", \"wb\")\n"
"\texcept IOError:\n"
"\t\tsys.stderr.write(\"Python: Could not create pyerr.txt in current directory.\\n\")\n"
"\tbackup = sys.path[:]\n"
"\tsys.path.append(\"" + path + "/data/ais\")\n"
"\ttry:\n"