I'm running the simplest possible test problem that is given with the pytzwhere package. The module imports, but I'm getting an error. pytzwhere seems like a good offline option for getting timezones from GPS coordinates, but there isn't much documentation. Any help on how to reconcile this is appreciated!
In [94]:
import tzwhere
w = tzwhere()
print w.tzNameAt(1.352083, 103.819836)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-94-0b50c8083e93> in <module>()
1 import tzwhere
2
----> 3 w = tzwhere()
4 print w.tzNameAt(1.352083, 103.819836)
TypeError: 'module' object is not callable
This has been resolved with the following code modification per the comments below -
In [108]:
from tzwhere import tzwhere
w = tzwhere.tzwhere()
print w.tzNameAt(1.352083, 103.819836)
-----------------------------------------------------------------------------
Reading json input file: /Users/user/anaconda/lib/python2.7/site-packages/tzwhere/tz_world_compact.json
Asia/Singapore
You cannot just instantiave w from module like w = tzwhere()
. tzwhere is a module containing class tzwhere. As Python correctly noted, module is not callable.
from tzwhere import tzwhere
w = tzwhere()
First line imports class tzwhere from module tzwhere.
Edit: If you do import "my way" :-) w = tzwhere()
is valid creation of w as instance of class tzwhere.
Usually in Python, class would be named TzWhere, which would avoid such confusion.
I assume you are trying to use https://github.com/pegler/pytzwhere/blob/master/tzwhere/tzwhere.py