Code Monkey home page Code Monkey logo

gae-pytz's People

Contributors

moraes avatar

Watchers

James Cloos avatar  avatar

gae-pytz's Issues

pytz bad import, setuptools issue?

I'm trying to load gae-pytz with the following command:

from pytz.gae import pytz

When that happens I get the following import error below.  Is this a setuptools 
issue? Any ideas?


ERROR:root:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 193, in Handle
    result = handler(self._environ, self._StartResponse)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\contrib\staticfiles\handlers.py", l
ine 68, in __call__
    return self.application(environ, start_response)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\core\handlers\wsgi.py", line 250, i
n __call__
    self.load_middleware()
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\core\handlers\base.py", line 45, in
 load_middleware
    mod = import_module(mw_module)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\autoload\middleware.py", line 8, in <modul
e>
    import_module('%s.models' % (app))
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\updater\models.py", line 4, in <module>
    from pytz.gae import pytz
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\libs\pytz\__init__.py", line 34, in <modul
e>
    from pkg_resources import resource_stream
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1642,
in LoadModuleRestricted
    return source_file.load_module(submodule_fullname)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\py_zipimport.py", line 246, in load_module
    submodname, is_package, fullpath, source = self._get_source(fullmodname)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\py_zipimport.py", line 207, in _get_source
    source = self.zipfile.read(relpath.replace(os.sep, '/'))
  File "C:\Python27\lib\zipfile.py", line 867, in read
    return self.open(name, "r", pwd).read()
  File "C:\Python27\lib\zipfile.py", line 882, in open
    zef_file = open(self.filename, 'rb')
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 592, i
n __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 
'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg'
INFO:root:"GET /invoice/ HTTP/1.1" 500 -
ERROR:root:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 193, in Handle
    result = handler(self._environ, self._StartResponse)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\contrib\staticfiles\handlers.py", l
ine 68, in __call__
    return self.application(environ, start_response)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\core\handlers\wsgi.py", line 250, i
n __call__
    self.load_middleware()
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\core\handlers\base.py", line 45, in
 load_middleware
    mod = import_module(mw_module)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\autoload\middleware.py", line 8, in <modul
e>
    import_module('%s.models' % (app))
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\updater\models.py", line 4, in <module>
    from pytz.gae import pytz
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1660,
in LoadModuleRestricted
    description)
  File "C:\Users\speedplane\Documents\Work\2010 - 2011\Programs\DocketUpdater\libs\pytz\__init__.py", line 34, in <modul
e>
    from pkg_resources import resource_stream
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1845,
in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1717,
in FindAndLoadModule
    description)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 676, i
n Decorate
    return func(self, *args, **kwargs)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 1642,
in LoadModuleRestricted
    return source_file.load_module(submodule_fullname)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\py_zipimport.py", line 246, in load_module
    submodname, is_package, fullpath, source = self._get_source(fullmodname)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\dist\py_zipimport.py", line 207, in _get_source
    source = self.zipfile.read(relpath.replace(os.sep, '/'))
  File "C:\Python27\lib\zipfile.py", line 867, in read
    return self.open(name, "r", pwd).read()
  File "C:\Python27\lib\zipfile.py", line 882, in open
    zef_file = open(self.filename, 'rb')
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 592, i
n __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 
'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg'
INFO:root:"GET /invoice/ HTTP/1.1" 500 -

Original issue reported on code.google.com by [email protected] on 3 Apr 2012 at 2:27

not work on windows

on windows, gae-pytz can't read zipped zoneinfo.

Original issue reported on code.google.com by surgo.jp on 14 Mar 2010 at 11:11

Attachments:

Caching timezones in a bulk

Currently the caching is done per timezone, and ends up in around ~500 
``memcache.get()`` queries, which slows down performance a lot.

I would propose caching all timezone info in one memcache record.

Original issue reported on code.google.com by [email protected] on 9 Jan 2013 at 7:27

pytz fails to work locally

To reproduce:
$ python
Python 2.5.1 (r251:54863, Jun 17 2009, 20:37:34) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytz.gae import pytz
>>> pytz.timezone('Europe/Amsterdam')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pytz/__init__.py", line 171, in timezone
    _tzinfo_cache[zone] = build_tzinfo(zone, open_resource(zone))
  File "pytz/__init__.py", line 86, in open_resource
    return loader.open_resource(name)
  File "pytz/gae.py", line 69, in open_resource
    zonedata = memcache.get(cache_key)
TypeError: unbound method get() must be called with memcache instance as first 
argument (got str instance instead)

Expected output is:
>>> pytz.timezone('Europe/Amsterdam')
<DstTzInfo 'Europe/Amsterdam' AMT+0:20:00 STD>


The fix is at the top of pytz/gae.py, to add in @classmethod in two places:

try:
    from google.appengine.api import memcache
except ImportError:
    # This means that we're not running under the SDK, likely a script
    class memcache(object):
        @classmethod
        def add(*args, **kwargs):
            pass

        @classmethod
        def get(*args, **kwargs):
            return None

Original issue reported on code.google.com by [email protected] on 17 Sep 2010 at 6:12

Uploading cron.yaml fails because time zone is not recognized

When calling "appcfg update_cron", the cron update fails when a timezone is 
used in cron.yaml:

$ bin/appcfg update_cron app
Application: ******
Host: appengine.google.com
Error parsing yaml file:
Unable to assign value 'Europe/Berlin' to attribute 'timezone':
timezone 'Europe/Berlin' is unknown
  in "app/cron.yaml", line 5, column 13

This error seems to be thrown at
google_appengine/google/appengine/api/croninfo.py:91
in the app engine SDK 1.5.1

I'm using gaepytz-2011h.


Original issue reported on code.google.com by [email protected] on 20 Jul 2011 at 12:19

Update to 2012 timezones

Could you update gae-pytz to include the 2012 timezones? Or would this be easy 
to do? In that case, I maybe could do it myself.

Original issue reported on code.google.com by [email protected] on 14 Mar 2012 at 9:29

Alternatives to gae-pytz

While implementing i18n and timezone in the project I am working at
(JobTracker), my solution was to fetch (and cache) at:
http://json-time.appspot.com/
which implements the complete pytz returning in json format.

Reference:
http://code.google.com/p/jobtracker/
(modules.queries.get_tz_utc_offset)

BR,

Original issue reported on code.google.com by [email protected] on 1 Mar 2010 at 2:16

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.