ozon / b3-plugin-advgeoip

This plugin extends B3, so that he can retrieve the country name of players.
0 stars 0 forks source link

NameError: global name 'pygeoip' is not defined #4

Open CeaselessOne opened 10 years ago

CeaselessOne commented 10 years ago

\b3\extplugins\advgeoip.py", line 57, in onStartup NameError: global name 'pygeoip' is not defined

This is the error message I'm getting in my B3 log. I've been at this for hours, but I can't find the actual problem.

ozon commented 10 years ago

Do you use the binary version of B3 or the python sources?

CeaselessOne commented 10 years ago

Ahh sorry I saw this message late, but I check back very often. I use windows binary. Also posted here: http://forum.bigbrotherbot.net/releases/advgeoip-plugin-error/

Copied from forums: I followed the directions as best I could. I'm running Windows binary. B3 v1.9.1

[quote]140713 17:16:54 BOT 'Starting Plugin advgeoip' 140713 17:16:54 ERROR 'Could not start plugin advgeoip' Traceback (most recent call last): File "b3\parser.pyo", line 789, in startPlugins File "b3\parser.pyo", line 772, in start_plugin File "C:\UserFiles\namehere\GameServers\85378541563741937453\b3\extplugins\advgeoip.py", line 57, in onStartup NameError: global name 'pygeoip' is not defined [/quote]

On line 57 [quote] self._geoip = pygeoip.GeoIP(self._geoip_db)[/quote]

This is line 56: [quote]elif self._geo_db_type == 'city':[/quote]

ozon commented 10 years ago

Please try this: Copy the pygeoip folder in the B3 installation folder.

CeaselessOne commented 10 years ago

It's been there already: "ServerFolder/B3/pygeoip" The reason I'm trying to get it working is because your other 'announcer' plugin relies on it. If I could use that plugin without the need for this one, it would be cool hehe

ozon commented 10 years ago

I tried a test with the binary version. It works when the pygeoip folder is in the folder extplugins. But i look for a better solution.

CeaselessOne commented 10 years ago

Ok. I moved it over to extplugins and get this message:

ERROR "handler AdvgeoipPlugin could not handle event Client Authenticated: GeoIPError: Invalid database type, expected City [('b3\parser.pyo', 1055, 'handleEvents', None), ('b3\plugin.pyo', 158, 'parseEvent', None), ('C:\UserFiles\DurmusAli\GameServers\TC25774263844603165856410\b3\extplugins\advgeoip.py', 85, 'onEvent', None), ('C:\UserFiles\DurmusAli\GameServers\TC25774263844603165856410\b3\extplugins\advgeoip.py', 71, '_add_geoattr', None), ('C:\UserFiles\DurmusAli\GameServers\TC25774263844603165856410\b3\extplugins\pygeoip\init.py', 531, 'record_by_addr', None)]"

Then, instead of using geoip which is shown in the example, I made it use the GeoLiteCity database and it's on now. I have pointed it to the GeoLiteCity database yesterday, but maybe me moving the 'pygeoip' folder trying to get it to work was the reason there was an error, so now I have the right combo.

I know it can be said it was my error, but adding to use GeoLiteCity as an example on the .ini file also will be useful so people will use it instead of GeoIP as the method states if they need to for your other plugin.

Since it's working, I'm gonna test your other 'announcer' plugin to see if it works now. It was made for BF3, but I'm trying it for CoD since you mentioned that possibility.

ozon commented 10 years ago

Thanks for the feedback. I will update the plugin soon.

CeaselessOne commented 10 years ago

Is there a messaging place you could be reached besides this one? I had a couple of unrelated questions.

ozon commented 10 years ago

I think the B3 forum ist the right place.

CeaselessOne commented 10 years ago

Well just like you said over there, it's a bit difficult because they don't let you pm there, but I'll get in contact with you somehow. Thanks for the help.

ozon commented 10 years ago

Use my mail rootdesign@gmail.com

cell13 commented 7 years ago

I meet the same problem after i installed the pygeoip using the command "pip install pygeoip". the old code: import pygeoip gip = pygeopip.GeoIP('GeoLiteCity.dat') rec = gip.record_by_addr(raw_input("input the IP of you want:")) print rec ee, there is something wrong, the error message is "NameError: name 'pygeopip' is not defined". You know, there is another way to use the method of module. So let's have a try the below code. the new code: from pygeoip import * gip = GeoIP('GeoLiteCity.dat') rec = gip.record_by_addr(raw_input("input the IP of you want:")) print rec YES! Here is no error again. A good day, thanks.