Hi,
Thank you for reply. I have tried your method but I still the error below when I run the ivr.py from SEMS. Is it that I cannot import the MySQLdb module from the IVR.py file. Please help
Traceback (most recent call last): File "/root/answer_machine/plug-in/ivr/scripts/ivr.py", line 4, in ? import MySQLdb File "/usr/lib/python2.2/site-packages/MySQLdb/__init__.py", line 27, in ? import _mysql ImportError: No module named _mysql (11533) WARNING: sig_usr (sems.cpp:72): signal 17 received (11533) INFO: sig_usr (sems.cpp:81): finished
regards, shirley
-----Original Message----- From: Martin Solli [SMTP:martin@strangedays.no] Sent: Monday, May 24, 2004 10:39 PM To: Shirley Toh Cc: serusers@lists.iptel.org Subject: Re: [Serusers] Python Script with IVR
Shirley Toh:
I am trying to read the import MySQLdb into the ivr.py script to read values from the sql database but I got error in missing modules. Please help. What should I do to be able to read values from the database in the ivr.py script for development purpose. Please help......Thanks in advance.
What you need to do is to link the MySQLdb module into Sems when you compile it. In plug-in/ivr/Makefile, change the module_ldflags line to something like this:
module_ldflags = -L/usr/lib/python$(PYTHON_VERSION)/config \ -lpython$(PYTHON_VERSION) -ldl -lpthread -lutil -lm \ -Xlinker -export-dynamic \ /usr/lib/python2.2/site-packages/_mysql.so \ /usr/lib/python2.2/lib-dynload/time.so \ /usr/lib/python2.2/lib-dynload/array.so
In short, you will need to link statically against any shared libray module that you use in Python, ie. any module whose name ends with '.so'.
This problem was recently discussed on the Sems list. I suggest you have a look in the archives for more info on this. http://lists.iptel.org/cgi-bin/mailman/listinfo/sems
-- .\artin Despite it's high cost, living remains popular.