From: | Stuart Bishop <stuart(at)stuartbishop(dot)net> |
---|---|
To: | Brian Sutherland <brian(at)vanguardistas(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpython intermittent ImportErrors |
Date: | 2013-01-17 08:18:09 |
Message-ID: | CADmi=6MLei9X90gOb5xWPvOkwicWCTGqbsA=f4TBFkqseJ359A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Jan 14, 2013 at 11:30 PM, Brian Sutherland
<brian(at)vanguardistas(dot)net> wrote:
> Hi,
>
> I have a plpython stored procedure which sometimes fails when I run my
> applications automated test suite. The procedure is called hundreds of
> times during the tests but only fails a few times, often with the
> following ImportError:
>
> Traceback (most recent call last):
> File "/Users/jinty/.buildout/eggs/setuptools-0.6c11-py2.7.egg/site.py", line 73, in <module>
> __boot()
> File "/Users/jinty/.buildout/eggs/setuptools-0.6c11-py2.7.egg/site.py", line 2, in __boot
> import sys, imp, os, os.path
> File "/Users/jinty/src/mp/lib/python2.7/os.py", line 49, in <module>
> import posixpath as path
> File "/Users/jinty/src/mp/lib/python2.7/posixpath.py", line 15, in <module>
> import stat
> ImportError: No module named stat
The first thing that pops out here is that the paths contain
references to buildout.
Can you confirm that the exception is actually being received from
PostgreSQL, or is the error coming from your test harness?
Is your plpython stored procedure supposed to be using the environment
constructed by buildout, or the system default environment?
(we use buildout for our Python code, but our plpythonu stored
procedures use the stock standard Python environment, as provided by
the Ubuntu packages).
If this is the correct environment, it sounds like you are triggering
some sort of race condition in the buildout generated .py files. You
might be able to confirm and/or work around the issue by getting your
own stanza added to the top of the generated site.py, explicitly
importing the problematic modules right at the top before any buildout
magic happens.
--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/
From | Date | Subject | |
---|---|---|---|
Next Message | Sumit Raja | 2013-01-17 09:12:01 | Re: Best method to compare subdomains |
Previous Message | ning chan | 2013-01-17 05:17:30 | Streaming Replication Failover |