Re: [NOVICE] Python modules for PL/Python?

Lists: pgsql-interfacespgsql-novice
From: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
To: pgsql-novice(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Python modules for PL/Python?
Date: 2005-03-06 18:56:46
Message-ID: a20i2qxoum5k$.dltedwv7mym9.dlg@40tude.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces pgsql-novice

Hello,

potentially dumb question: if I want to use non-standard Python modules
within PL/Python, I guess I have to recompile something (plpython.dll in
the /lib folder)?

If I would like to avoid re-doing this over and over again in the future,
is there a way to make postgresql use the "standard" installation of Python
which I already have on my system?

TIA,

Best regards

Wolfgang Keller


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [NOVICE] Python modules for PL/Python?
Date: 2005-03-06 19:26:32
Message-ID: 20050306192632.GB8834@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces pgsql-novice

On Sun, Mar 06, 2005 at 07:56:46PM +0100, Wolfgang Keller wrote:

> potentially dumb question: if I want to use non-standard Python modules
> within PL/Python, I guess I have to recompile something (plpython.dll in
> the /lib folder)?

Are you having trouble using a module from a PL/Python function?
If so, then please post a simple function and the error you get
when you try to use it, or describe what happens if there's no
error.

> If I would like to avoid re-doing this over and over again in the future,
> is there a way to make postgresql use the "standard" installation of Python
> which I already have on my system?

What OS and versions of PostgreSQL and Python are you using?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
To: pgsql-novice(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [NOVICE] Python modules for PL/Python?
Date: 2005-03-07 06:39:53
Message-ID: 81wj7n129ysu$.1sn8d1un8kgdx$.dlg@40tude.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces pgsql-novice

>> potentially dumb question: if I want to use non-standard Python modules
>> within PL/Python, I guess I have to recompile something (plpython.dll in
>> the /lib folder)?
>
> Are you having trouble using a module from a PL/Python function?

Oops, I didn't even try to use anything non-standard...

I stupidly assumed that Postgres comes with its own Python interpreter
compiled-in...?

> What OS and versions of PostgreSQL and Python are you using?

Right now: Windows XP, Postgres 8.0.1, Python 2.3
Soon: MacOS X, Postgres 8.X, Python 2.4

Best regards

Wolfgang Keller


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Wolfgang Keller <wolfgang(dot)keller(dot)nospam(at)gmx(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [NOVICE] Python modules for PL/Python?
Date: 2005-03-07 07:33:16
Message-ID: 20050307073316.GA23982@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces pgsql-novice

On Mon, Mar 07, 2005 at 07:39:53AM +0100, Wolfgang Keller wrote:
> >> potentially dumb question: if I want to use non-standard Python modules
> >> within PL/Python, I guess I have to recompile something (plpython.dll in
> >> the /lib folder)?
> >
> > Are you having trouble using a module from a PL/Python function?
>
> Oops, I didn't even try to use anything non-standard...

So try something :-) If you have problems then please report what
you did and what happened.

> I stupidly assumed that Postgres comes with its own Python interpreter
> compiled-in...?

No, at least not on Unix-like platforms. PL/Python is a shared
object (plpython.so) that's linked against libpython, which is the
Python runtime library for whatever version of Python you have
installed. That library should be able to find modules in the same
module search path (sys.path) that an ordinary Python program uses.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/