Bug#599047: python-tz: use of pytz generates UserWarning about repeated imports
Geoff Crompton
geoffc at trinity.unimelb.edu.au
Mon Oct 4 04:16:42 UTC 2010
Package: python-tz
Version: 2008c-2
Severity: normal
I have a script that imports some django (and hence mysql) libraries, before
then importing pytz. When I run the script I see:
geoffc at chiraz:~/svk/passwordaging/trunk/bin$ ./report-force-change-rate
/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module
_mysql was already imported from
/var/lib/python-support/python2.5/_mysql.so, but
/var/lib/python-support/python2.5 is being added to sys.path
from pkg_resources import resource_stream
I've patched the lenny package to get one that works for me, the diff is:
--- python-tz-2008c.orig/pytz/__init__.py
+++ python-tz-2008c/pytz/__init__.py
@@ -25,11 +25,6 @@
import sys, datetime, os.path, gettext
-try:
- from pkg_resources import resource_stream
-except ImportError:
- resource_stream = None
-
It looks like the only place that resource_stream gets used in
pytz/__init__.py has already been removed by the debian specific patch.
So removing the attempt to import it seems to make sense. I have to admit
that I don't know python well enough to understand what resource_stream
is used for, or to understand the warning I'm getting.
I had a look at the 2010b-1 package, and it looks like this code is still
present in squeeze and sid as well. So I imagine I'd get the same warning,
though I haven't confirmed this on a squeeze or sid system.
-- System Information:
Debian Release: 5.0.6
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages python-tz depends on:
ii python 2.5.2-3 An interactive high-level object-o
ii python-central 0.6.8 register and build utility for Pyt
ii tzdata 2010j-0lenny1 time zone and daylight-saving time
python-tz recommends no packages.
python-tz suggests no packages.
-- no debconf information
More information about the pkg-zope-developers
mailing list