From: Michael Fuhr <mike@fuhr.org>
To: Eugene Prokopiev <prokopiev@stc.donpac.ru>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: pl/pyton: exceptions.ImportError: No module named email.Parser
Date: Sun, 27 Nov 2005 12:34:29 -0700
Message-ID: <20051127193429.GA64790@winnie.fuhr.org> (raw)
In-Reply-To: <4389CDF2.6020805@stc.donpac.ru>
References: <4389CDF2.6020805@stc.donpac.ru>
On Sun, Nov 27, 2005 at 06:17:06PM +0300, Eugene Prokopiev wrote:
> dbmail=# select get_header(messageblk) from dbmail_messageblks;
> ERROR: plpython: function "get_header" failed
> DETAIL: exceptions.ImportError: No module named email.Parser
Your function works here with Python 2.4.2 and PostgreSQL 8.0.4 and
8.1.0, although I had to use parser.parsestr() instead of parser.parse()
because the latter expects a file-like argument (an alternative would
be to use parse() and pass a StringIO object).
As for why the import fails, might PL/Python be using a different
version of Python than the command-line python program? What does
the following function show?
CREATE FUNCTION pyversion() RETURNS text AS $$
import sys
return sys.version + '\n' + '\n'.join(sys.path)
$$ LANGUAGE plpythonu;
Does this function show the same version and module search path as
an ordinary Python program?
python -c 'import sys; print sys.version, sys.path'
What do the following commands show?
ldd /path/to/python
ldd /path/to/plpython.so
--
Michael Fuhr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: mike@fuhr.org, prokopiev@stc.donpac.ru
Subject: Re: pl/pyton: exceptions.ImportError: No module named email.Parser
In-Reply-To: <20051127193429.GA64790@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox