Search Postgresql Archives

Re: plpython intermittent ImportErrors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 14, 2013 at 11:30 PM, Brian Sutherland
<brian@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx>
http://www.stuartbishop.net/


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux