Thread: Python modules for PL/Python?
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
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/
>> 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
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/