[Freeswitch-users] Not Able to Connect to mysql

Aqs Younas aqsyounas at gmail.com
Tue Sep 16 21:31:44 MSD 2014


Hi, All

I am unable to connect to mysql for querying some data that I could use in
my python script.
Here is my python script.

 #!/usr/bin/python
import os
import re
import json
import MySQLdb
from freeswitch import *

db = MySQLdb.connect("localhost","root","hammer","gvt")

def handler(session, args):
        session.answer()
        callerNumber=session.getVariable("caller_id_number")
        calleeNumber=session.getVariable("destination_number"
        consoleLog("info", callerNumber)
        consoleLog("info", calleeNumber)

When i run this i got this error.

2014-09-16 04:55:18.803406 [ERR] mod_python.c:239 Error reloading module
2014-09-16 04:55:18.803406 [ERR] mod_python.c:164 Python Error by calling
script "load": <class '_mysql_exceptions.InternalError'>
Message: (-1, 'server not initialized')
Exception: None

Traceback (most recent call last)
        File: "/usr/lib/python2.7/load.py", line 9, in <module>
        File: "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line
81, in Connect
        File: "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py",
line 179, in __init__

Could someone please help me out how to connect freeswitch to mysql for
querying data..:)

Thanks in Advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140916/bc19fcb9/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list