Message: 9
Date: Sun, 30 Nov 2008 18:42:30 -0800 (PST)
From: Marc Orenberg <marc@kasteris.com>
Subject: [Freeswitch-users] Problem importing modules in mod_python
To: freeswitch-users@lists.freeswitch.org
Message-ID: <195670.44941.qm@web50805.mail.re2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

In the latter versions of mod_python, I'm unable to import standard python modules such as time and MySQLdb.?
For example, the following script works fine in version 1.0.1:

??? ??? import time
??? ??? import os
??? ??? from freeswitch import *
??? ??? def handler(session, args):
??? ??? ??? session.answer()
??? ??? ??? session.execute("sleep", "2000")
??? ??? ??? session.streamFile("/usr/local/freeswitch/prompts/01Welcome.wav")
??? ??? ??? return(session)

But in freeswitch-1.0.latest.tar.gz, and svn versions 10556-10558, I get the following error:

??? ??? 2008-11-30 21:13:09 [ERR] mod_python.c:129 eval_some_python() Error reloading module
??? ??? Traceback (most recent call last):
??????? File "/usr/lib/python2.4/site-packages/scripts/test.py", line 1, in ?
??? ??? import time
??? ??? ImportError: /usr/lib/python2.4/lib-dynload/timemodule.so: undefined symbol: PyExc_ValueError

Thanks for your help!

I have run into the same problem and put some documentation on the wiki:

http://wiki.freeswitch.org/wiki/Mod_python#ImportError:_.2F...2Fdatetime.so:_undefined_symbol:_PyExc_IOError

I think something changed in freeswitch in the way it is loading modules, or at least the way it is loading mod_python.  This behavior appeared all of the sudden in recent freeswitch versions.

HTH