Looks like you need to access the file via the filesystem path, not the URL, so try:
import os gic = pygeoip.GeoIP(os.path.join(request.folder, 'static', 'GeoLiteCity.dat' ), pygeoip.MEMORY_CACHE) Anthony On Saturday, October 26, 2013 1:04:33 PM UTC-4, greaneym wrote: > > Hi, > > I have written an app using pygeoip and MaxMind data files that works but > I want to make a change. This library with the data files allows > one to map ip addresses to geographic locations. > > in my controller, I have a line, > > gic = pygeoip.GeoIP('/User/mgreaney/geostuff/GeoLiteCity.dat'), > pygeoip.MEMORY_CACHE) > which works fine. but I want to be able to put the file in the static > directory and access from there. > > I tried this change > > gic = pygeoip.GeoIP(URL('static','GeoLiteCity', extension='.dat'), > pygeoip.MEMORY_CACHE) > > but I get an error stating that the file does not exist. It is in the > directory static. > > file: GeoLiteCity.dat > GeoLiteCity.dat: data > > Maxmind also gives .dat files that can be read into a database. > > But is it possible to use their data file served from the static > directory? Has anyone else tried this? > > thanks for any suggestions. > > Margaret > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.