AI doesn't move at all

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#16 Post by Dilvish »

hmm, well that makes it look like the manual import had worked fine. If you try that same thing, opening python, import timing, and then instead of or in addition to the help(timing), try

Code: Select all

Timer = timing.Timer"
and see if it somehow still gives you an error. The output you got from help certainly makes it look like it should work fine.

When you changed the code in the files over to

Code: Select all

import timing
Timer = timing.Timer
did you retype that all by hand, or had you edited the prexisting line (and then perhaps copy-pasted)-- I'm wondering if there was something weirdly off with the characters in a way that didn't visibly render...? I'm really stretching for ideas...
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

gvdm
Space Floater
Posts: 43
Joined: Sun Nov 06, 2011 11:04 am

Re: AI doesn't move at all

#17 Post by gvdm »

I typed it each time.

Code: Select all

2014-09-08 16:58:16,717 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/InvasionAI.py", line 16
2014-09-08 16:58:16,717 ERROR AI :     Timer = timing.Timer"
2014-09-08 16:58:16,717 ERROR AI :                         ^
2014-09-08 16:58:16,717 ERROR AI : SyntaxError: EOL while scanning string literal
and

Code: Select all

>>> import timing
>>> Timer = timing.Timer"
  File "<stdin>", line 1
    Timer = timing.Timer"
                        ^
SyntaxError: EOL while scanning string literal
But without the " it works fine,

Code: Select all

>>> Timer = timing.Timer
>>> help(Timer)
shows what you would expect, the class that showed in help(timing) without the module stuff.

It seems this bug is destined to haunt the forums and remain unanswered. Till next time, maybe I check back soon, maybe in another year or two.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#18 Post by Dilvish »

gvdm wrote:But without the " it works fine,

Code: Select all

>>> Timer = timing.Timer
>>> help(Timer)
ah yeah, the ' " ' at the end of the line was a typo, sorry about the confusion.

So a manual import of it seems to work just totally fine. I'm stumped.

I hope you don't just go way for a couple years, though-- the fix of just commenting out the lines using the Timer wouldn't be much more work than you've already done, and would let you play just fine -- there are a LOT of improvements in 0.4.4 over 0.4.3...
Last edited by Dilvish on Mon Sep 08, 2014 5:04 pm, edited 1 time in total.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12802
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI doesn't move at all

#19 Post by Geoff the Medio »

Is there another "timing.py" somewhere in the path?

Chriss
Dyson Forest
Posts: 231
Joined: Sun May 11, 2008 10:50 am

Re: AI doesn't move at all

#20 Post by Chriss »

Is the python which runs the AI from within FO the same python that gets accessed from the command line? Are there multiple on Fedora? Python2 vs python3?
Attached patches are released under GPL 2.0 or later.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#21 Post by Dilvish »

Geoff the Medio wrote:Is there another "timing.py" somewhere in the path?
I had looked into that, there are no standard modules named 'timing', and the search priorities are (at least if there is not a 'builtin' module by that name) to search the local directory before anywhere else.

Chriss wrote:Is the python which runs the AI from within FO the same python that gets accessed from the command line? Are there multiple on Fedora? Python2 vs python3?
Hmm, I think not necessarily the same version -- I think the the version invoked by FO is controlled by the build process.

gvdm: if you're still around, to shed light on just what is being imported by FO, there's one more thing we could try -- putting some of this checking you just did manually into Invasion.py -- so instead of

Code: Select all

from timing import Timer
have it do

Code: Select all

import pydoc
import timing
print pydoc.render_doc(timing)
Timer = timing.Timer
in a working installation it should give (in the AI logfile) the same results as we saw from the manual import and help(timing)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

gvdm
Space Floater
Posts: 43
Joined: Sun Nov 06, 2011 11:04 am

Re: AI doesn't move at all

#22 Post by gvdm »

Code: Select all

2014-09-08 23:05:36,111 DEBUG AI : Python module search path: /usr/lib64/python27.zip:/usr/lib64/python2.7/:/usr/lib64/python2.7/plat-
linux2:/usr/lib64/python2.7/lib-tk:/usr/lib64/python2.7/lib-old:/usr/lib64/python2.7/lib-dynload
2014-09-08 23:05:36,111 DEBUG AI : Initializing C++ interfaces for Python
2014-09-08 23:05:36,467 DEBUG AI : Python stdout and stderr redirected
2014-09-08 23:05:36,683 DEBUG AI : Python Library Documentation: module timing
2014-09-08 23:05:36,684 DEBUG AI : 
2014-09-08 23:05:36,684 DEBUG AI : NAME
2014-09-08 23:05:36,684 DEBUG AI :     timing
2014-09-08 23:05:36,684 DEBUG AI : 
2014-09-08 23:05:36,684 DEBUG AI : FILE
2014-09-08 23:05:36,685 DEBUG AI :     /usr/lib64/python2.7/lib-dynload/timingmodule.so
2014-09-08 23:05:36,685 DEBUG AI : 
2014-09-08 23:05:36,685 DEBUG AI : FUNCTIONS
2014-09-08 23:05:36,685 DEBUG AI :     finish(...)
2014-09-08 23:05:36,685 DEBUG AI :     
2014-09-08 23:05:36,685 DEBUG AI :     micro(...)
2014-09-08 23:05:36,685 DEBUG AI :     
2014-09-08 23:05:36,685 DEBUG AI :     milli(...)
2014-09-08 23:05:36,688 DEBUG AI :     
2014-09-08 23:05:36,688 DEBUG AI :     seconds(...)
2014-09-08 23:05:36,688 DEBUG AI :     
2014-09-08 23:05:36,688 DEBUG AI :     start(...)
2014-09-08 23:05:36,688 DEBUG AI : 
2014-09-08 23:05:36,688 DEBUG AI : 
2014-09-08 23:05:36,689 ERROR AI : Traceback (most recent call last):
2014-09-08 23:05:36,689 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/FreeOrionAI.py", line 11, in <module>
2014-09-08 23:05:36,690 ERROR AI :     import AIstate
2014-09-08 23:05:36,690 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/AIstate.py", line 5, in <module>
2014-09-08 23:05:36,690 ERROR AI :     import AIFleetMission
2014-09-08 23:05:36,690 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/AIFleetMission.py", line 3, in <module>
2014-09-08 23:05:36,691 ERROR AI :     import AIFleetOrder
2014-09-08 23:05:36,691 ERROR AI :     import MoveUtilsAI
2014-09-08 23:05:36,691 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/MoveUtilsAI.py", line 7, in <module>
2014-09-08 23:05:36,692 ERROR AI :     import ColonisationAI
2014-09-08 23:05:36,692 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/ColonisationAI.py", line 10, in <module>
2014-09-08 23:05:36,692 ERROR AI :     import ProductionAI
2014-09-08 23:05:36,692 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/ProductionAI.py", line 9, in <module>
2014-09-08 23:05:36,692 ERROR AI :     import PriorityAI
2014-09-08 23:05:36,693 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/PriorityAI.py", line 8, in <module>
2014-09-08 23:05:36,693 ERROR AI :     import InvasionAI
2014-09-08 23:05:36,698 ERROR AI :   File "/home/gvdm/freeorion-code/FreeOrion/default/AI/InvasionAI.py", line 17, in <module>
2014-09-08 23:05:36,698 ERROR AI :     Timer = timing.Timer
2014-09-08 23:05:36,698 ERROR AI : AttributeError: 'module' object has no attribute 'Timer'
So, I have /usr/lib64/python2.7/lib-dynload/timingmodule.so whatever that is and is not timing.py

oris1024
Space Krill
Posts: 1
Joined: Mon Sep 08, 2014 8:32 pm

Re: AI doesn't move at all

#23 Post by oris1024 »

was just dealing with non-moving AI myself on ubuntu 14.04 (and 13.10). After reading this topic and not finding nothing about timers in my log files decided to check on my install. My findings:

Had this problem with: freeorion-0.4.3_i386.deb
Don't have it no more with: freeorion_0.4.3+svn7247-1_i386.deb and freeorion-data_0.4.3+svn7247-1_all.deb

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#24 Post by Dilvish »

there ya go. rename the freeorion timing.py file to FO_timing.py, and change the imports to

Code: Select all

from FO_timing import Timer
and you should be good to go.

I'll try look a little more into that timing module you have, and perhaps we'll change the name of ours across the board.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#25 Post by Dilvish »

Hmm, it's hard finding out much about that module -- from what I can find it appears to be specific to Fedora, for which it is apparently standard in python 2.7. That's a good enough reason to rename ours though. I'll try to do that and post a patch a little later.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI doesn't move at all

#26 Post by Dilvish »

ok I committed a name change, as r7710. Since this appears it would affect all Fedora users I made a new Support forum post with the title explicitly referencing an AI crash in Fedora; a patch is attached to that post.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply