Embedding Python - time module problem

Jim jbublitzNO at SPAMnwinternet.com
Tue Jun 18 16:37:23 EDT 2002


Richard Townsend wrote:

> If I substitute "os" or "sys" for "time" then no error occurs. However
> "math" does give a similar error.  

> If I run the interpreter on its own, I can import time and math with no
> problems. 

> I am using Python 2.2.1 on HP-UX 11i

> Is there something special I need to do to be able to import time and
> math modules when using embedded Python?

This sounds similar to the problem I had under Linux -
sys is builtin, time and math aren't, and the interpreter
symbols needed aren't available to the time and math
libs.

If you're using something like 'dlopen' to import the
interpreter, it needs to happen with the RTLD_GLOBAL
flag set. If you're statically linking, there's probably
an equivalent linker switch. I was using KDE which has
a method for globally loading libs. libtool looked
messier, but fortunately I didn't need to get into it.

man dlopen (at least for Linux).

Jim







More information about the Python-list mailing list