Re: pl/pyton: exceptions.ImportError: No module named email.Parser

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: pl/pyton: exceptions.ImportError: No module named email.Parser
Дата
Msg-id 20051127193429.GA64790@winnie.fuhr.org
обсуждение исходный текст
Ответ на pl/pyton: exceptions.ImportError: No module named email.Parser  (Eugene Prokopiev <prokopiev@stc.donpac.ru>)
Ответы Re: pl/pyton: exceptions.ImportError: No module named
Список pgsql-interfaces
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


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Eugene Prokopiev
Дата:
Сообщение: pl/pyton: exceptions.ImportError: No module named email.Parser
Следующее
От: Andy Chambers
Дата:
Сообщение: PG_COMMAND_OK oid information required