Re: psycopg used in a ASP page fails

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Barend Köbben <kobben(at)itc(dot)nl>
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: psycopg used in a ASP page fails
Date: 2011-02-15 11:52:21
Message-ID: AANLkTinSY1cLJ8g5v+fh1AK-vguLg3coH+DH0DZN3Bub@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

2011/2/15 Barend Köbben <kobben(at)itc(dot)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

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2011-02-15 12:22:10 Re: Proposal: efficient iter on named cursors
Previous Message Barend Köbben 2011-02-15 11:15:55 psycopg used in a ASP page fails