Re: psycopg used in a ASP page fails - Mailing list psycopg

From Daniele Varrazzo
Subject Re: psycopg used in a ASP page fails
Date
Msg-id AANLkTinSY1cLJ8g5v+fh1AK-vguLg3coH+DH0DZN3Bub@mail.gmail.com
Whole thread Raw
In response to psycopg used in a ASP page fails  (Barend Köbben <kobben@itc.nl>)
Responses Re: psycopg used in a ASP page fails  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
2011/2/15 Barend Köbben <kobben@itc.nl>:
> Hi there,
>
> I have the strange case of the same Python code importing psycopg is
> failing in an ASP environment while working as stand-alone or CGI
> programme:
>
> This is the code:
> import psycopg2
>
> This works fine when running in the python IDLE or on the IIS 6.0 server
> as a .py CGI script. However, when run as an ASP script (the same code in
> between <% %> tags in a .asp file), it fails with this message:
>
> Python ActiveX Scripting Engine error '80020009'
> Traceback (most recent call last):
>  File "<Script Block >", line 4, in <module>
>    import psycopg2
>  File "C:\Python27\lib\site-packages\psycopg2\__init__.py", line 65, in
> <module>
>    from psycopg2 import tz
> ImportError: cannot import name tz

May this be the same problem Jason is currently addressing. Could you
please test with both psycopg 2.4 beta2 and 2.3.2 and report the
result?

I've also found this:
<http://stackoverflow.com/questions/4212240/importerror-cannot-import-name-tz-psycopg2>.
Well, that sucks! But I think it may be your problem. Have you
installed psycopg using easy_install?

I wonder if it can be solved by marking psycopg2 not zip-safe (when
psycopg2 is installed via easy_install, I see the log "zip_safe flag
not set; analyzing archive contents...", which makes me think there is
an option). Uhm... no. Reading
<http://packages.python.org/distribute/setuptools.html#setting-the-zip-safe-flag>
looks like psycopg is considered unsafe as it contains a C extension.
So I'm afraid it will keep on sucking :( While at it, I'm also
noticing that "easy_install psycopg2" is installing 2.4 beta2 even if
2.3.2 is the last version listed on PyPI and the beta is nowhere. At
which, I give up thinking easy_install is any good at all.

-- Daniele

psycopg by date:

Previous
From: Barend Köbben
Date:
Subject: psycopg used in a ASP page fails
Next
From: Daniele Varrazzo
Date:
Subject: Re: Proposal: efficient iter on named cursors