diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-02-17 10:45:18 +0000 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-02-17 10:45:18 +0000 |
| commit | 1ba5f104c9154966180fbb0cd8d6cb5156989c1a (patch) | |
| tree | c2629030bec83c10d5dc67e6518303d622a046b2 | |
| parent | 3b10ef899840d5e8c64a765b008c25eb00095892 (diff) | |
| download | psycopg2-1ba5f104c9154966180fbb0cd8d6cb5156989c1a.tar.gz | |
Import _psycopg as the first module in the package
Failing to do so, the real cause of the _psycopg import failed may get
hidden and people may get a misleading error such as "cannot import name
tz" instead.
| -rw-r--r-- | lib/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/__init__.py b/lib/__init__.py index 4b9e22a..48a9847 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -62,7 +62,9 @@ if sys.version_info[0] >= 2 and sys.version_info[1] >= 4: RuntimeWarning) del sys, warnings -from psycopg2 import tz +# Note: the first internal import should be _psycopg, otherwise the real cause +# of a failed loading of the C module may get hidden, see +# http://archives.postgresql.org/psycopg/2011-02/msg00044.php # Import the DBAPI-2.0 stuff into top-level module. @@ -78,6 +80,9 @@ from psycopg2._psycopg import NotSupportedError, OperationalError from psycopg2._psycopg import connect, apilevel, threadsafety, paramstyle from psycopg2._psycopg import __version__ +from psycopg2 import tz + + # Register default adapters. import psycopg2.extensions as _ext |
