barolet / kovans-ogbot

Automatically exported from code.google.com/p/kovans-ogbot
0 stars 0 forks source link

getFleetSlots > AttributeError: 'NoneType' object has no attribute 'group' #294

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ENGLISH ONLY.
IF ANY OF THE INFO BELOW IS MISSING THE BUG REPORT WILL BE DELETED.
Thank you.

Bot version: 3.1b
OGame server language: Fr
OGame server version: 0.83
Using admirals or commander (specify)?: No
Operating System: Vista 32bit

Description of the problem:
The bot tries to see how many fleets slots I have but can't get it.

Log file contents:
Traceback (most recent call last):
  File "src\OGBot.py", line 106, in run
  File "src\OGBot.py", line 139, in _connect
  File "src\WebAdapter.py", line 411, in updatePlayerData
  File "src\WebAdapter.py", line 602, in getFleetSlots
AttributeError: 'NoneType' object has no attribute 'group'

Please provide any additional information below:
In German or English you have something like that
    <td style='background-color:transparent;'>
    Fleets or Flotten 0 / 10    </td>

but in French this is
<td style="background-color: transparent;">
    Flottes 0 sur 10    </td>

The / becomes sur in french fleets page.
I don't know if it has something to deal with it but it's been hours that I
look for a solution and that's the only thing I found about it.
Sorry if my english is bad.
Thank you for listening to me :-)

Original issue reported on code.google.com by maxime.p...@yahoo.fr on 3 Feb 2009 at 3:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If You understad python, you can try following temp solution, I did not try
by myself. Only go over the code

1. Change re code 
'maxSlots':re.compile(r"%s\s*([0-9]+)\s*%s\s*([0-9]+)" %  
translations['maxFleets'],
translations['slash'], re.I),

2. Add "slash = sur" to language file

To Vash:
I am also update a Kovan's Mod Bot: ogrobot.googlecode.com, I think we can 
learn from
each other, I am also new to PyQt :)

MSN: jetic@msn.com

Original comment by je...@sina.com on 3 Feb 2009 at 6:39

GoogleCodeExporter commented 8 years ago
nice to meet you! maybe we could merge the two branches

Original comment by brain...@gmail.com on 3 Feb 2009 at 7:30

GoogleCodeExporter commented 8 years ago
I'm sorry I don't understand python so I don't think that could help me.
Still, I tried to find the code you told me to change (I opened the .py file 
with
WordPad) but I didn't find anything.
In fact, I thought the problem was this line :
'fleetSlots':re.compile(r"%s[\s]*([0-9]+) \/ ([0-9]+)" 
%(translations['fleets']), re.I),

or this one : fleetSlots = self.REGEXPS['fleetSlots'].search(page)
        player.totalFleetSlots = int(fleetSlots.group(2))
    player.freeFleetSlots = player.totalFleetSlots - int(fleetSlots.group(1))
The last one is the damn line 602.
The two can be find in the WebAdapter.py file.

Remember that I don't understand python, so I don't really know what I am 
touching
here, if I am doing something wrong or if I am missing the point, tell me ! :D

Even if I still have my issue, I appreciate your help.
I tried to go and see your bot though, but I found it very difficult and didn't
understand how it works at all. I've downloaded Python but I don't understand 
what
does it do. This is the really first time I use this kind of software, I'm 
sorry for
my ignorance. :-(

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 7:33

GoogleCodeExporter commented 8 years ago
the 2nd comment offers a temporary solution, and I will look for a long term 
one when
I get some time. 

Original comment by brain...@gmail.com on 3 Feb 2009 at 7:33

GoogleCodeExporter commented 8 years ago
Ok, but I just want to know how to do it.
Where do I find the line I have to change ?
I'm pretty sure I did well the second step : add the slash = sur line in the 
language
file, but as I can't do the first step it's useless. So how do I do it ?

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 7:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
For first step, just change code in WebAdapter.py from:
'fleetSlots':re.compile(r"%s[\s]*([0-9]+) \/ ([0-9]+)" 
%(translations['fleets']), re.I),
to
'fleetSlots':re.compile(r"%s\s*([0-9]+)\s*%s\s*([0-9]+)" %  
translations['fleets'],
translations['slash'], re.I),

please try :)

Original comment by je...@sina.com on 3 Feb 2009 at 8:25

GoogleCodeExporter commented 8 years ago
Sorry, when I do that, I get this message in the logfile :
Traceback (most recent call last):
  File "src\OGBot.py", line 106, in run
  File "src\OGBot.py", line 137, in _connect
  File "src\WebAdapter.py", line 160, in __init__
  File "src\WebAdapter.py", line 359, in generateRegexps
TypeError: not enough arguments for format string

New message, new error =/ ...
I already try in fact, but I didn't do the other changes as the "\s*%s\s*" or 
the
"()" less.

Just to ask you, I'm trying my best to understand your bot but I still can't 
get it.
I've downloaded the file you ask, but I don't get what to do (and one of the 
link is
dead). Sorry to be away from the point but I really want to understand. If you 
don't
mind I'll be happy to talk about it somewhere else.
I'm sure I'll be less such a pain if I could begin to understand how this whole 
thing
work ! :D

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 8:42

GoogleCodeExporter commented 8 years ago
By the way, when I do the change you told me, the bot can't even log in my 
account.

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 8:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
please take care of indent and the code should be in one line.
or you can add my MSN: jetic@msn.com

Original comment by je...@sina.com on 3 Feb 2009 at 9:05

GoogleCodeExporter commented 8 years ago
I'm sorry but I'm really doing everything. It must be the tenth time that I'm 
doing
it again. It is in one line. But I've always the same message.

  File "src\WebAdapter.py", line 359, in generateRegexps
TypeError: not enough arguments for format string

This is the line, but it doesn't want to work. And I can swear I'm writing the 
good
thing. You can check if you want.

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 9:28

Attachments:

GoogleCodeExporter commented 8 years ago
I put you on my list. My MSN is maxip91@hotmail.com

Original comment by maxime.p...@yahoo.fr on 3 Feb 2009 at 9:36

GoogleCodeExporter commented 8 years ago
Sorry, But forget "()"

'fleetSlots':re.compile(r"%s\s*([0-9]+)\s*%s\s*([0-9]+)" %  
(translations['fleets'],
translations['slash']), re.I),

Original comment by je...@sina.com on 3 Feb 2009 at 9:56

GoogleCodeExporter commented 8 years ago
Thank you jetic

Original comment by King.Vash@gmail.com on 3 Feb 2009 at 2:50

GoogleCodeExporter commented 8 years ago
this is what I used 

fleetSlots':re.compile(r"%s[\s]*([0-9]+).*?([0-9]+)" %(translations['fleets']), 
re.I),

Original comment by King.Vash@gmail.com on 3 Feb 2009 at 2:59

GoogleCodeExporter commented 8 years ago
I think the final target should the bot could automaic find all translation by 
it self,
I am now moving on that way.

Original comment by je...@sina.com on 4 Feb 2009 at 1:47

GoogleCodeExporter commented 8 years ago

Original comment by King.Vash@gmail.com on 8 Feb 2009 at 8:34

GoogleCodeExporter commented 8 years ago
looking for software to v 0.83 ogame.pt someone get me?

Original comment by armando....@gmail.com on 22 Feb 2009 at 8:30