Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to properly add PyTZ to a Google App Engine application?
    text
    copied!<p>This is a little embarrassing, but I have not been able to find good resources on this topic.</p> <p>I'm working on a Google App Engine application that requires sophisticated time zone conversions. Since I am nowhere near the imposed quotas, I have opted to go with PyTZ. However, I must be doing something wrong. What I've done so far is:</p> <ol> <li>Downloaded PyTZ as a tarball</li> <li>Installed it and copied the <code>pytz</code> directory into the root of my app (it is a sibling of the <code>webapp</code> directory, where <code>app.yaml</code> is located).</li> </ol> <p>However, if I try to instantiate timezones, PyTZ can never seem to find any. Here is a sample session from GAE's interactive console:</p> <pre><code>from pytz import timezone rome = timezone('Europe/Rome') </code></pre> <p>The output is the following:</p> <pre><code>Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/admin/__init__.py", line 210, in post exec(compiled_code, globals()) File "&lt;string&gt;", line 3, in &lt;module&gt; File "/Library/Python/2.5/site-packages/pytz-2009j-py2.5.egg/pytz/__init__.py", line 157, in timezone UnknownTimeZoneError: 'Europe/Rome' </code></pre> <p>What is it I am doing wrong? Thank you in advance for your help.</p> <p><strong>NOTE</strong>: If I just use the python interactive shell locally things work as expected:</p> <pre><code>&gt;&gt;&gt; from pytz import datetime, timezone &gt;&gt;&gt; rome = timezone('Europe/Rome') &gt;&gt;&gt; rome.localize(datetime.datetime.now()) datetime.datetime(2009, 11, 12, 0, 4, 52, 990114, tzinfo=&lt;DstTzInfo 'Europe/Rome' CET+1:00:00 STD&gt;) </code></pre> <p><em>Edit</em>: I need to clarify I'm not using a zipped version of PyTZ. I have included the whole <code>zoneinfo</code> directory in my project:</p> <pre><code>pc-morena:pytz lyudmilangelov$ cd zoneinfo/ pc-morena:zoneinfo lyudmilangelov$ ls -l total 448 drwxr-xr-x@ 55 lyudmilangelov staff 1870 Nov 10 12:48 Africa drwxr-xr-x@ 135 lyudmilangelov staff 4590 Nov 10 12:48 America drwxr-xr-x@ 12 lyudmilangelov staff 408 Nov 10 12:48 Antarctica drwxr-xr-x@ 3 lyudmilangelov staff 102 Nov 10 12:48 Arctic drwxr-xr-x@ 93 lyudmilangelov staff 3162 Nov 10 12:48 Asia ... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload