mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
sip_to_pjsip: Enable python3 compatibility.
The script remains compatible with Python 2.7 but now also works with Python 3.3 and newer; to ease the migration from chan_sip to chan_pjsip. ASTERISK-27811 Change-Id: I59cc6b52a1a89777eebcf25b3023bdf93babf835
This commit is contained in:
committed by
Corey Farrell
parent
9f1e1d153a
commit
2d81709ab1
@@ -1,6 +1,13 @@
|
||||
from astconfigparser import MultiOrderedConfigParser
|
||||
|
||||
import MySQLdb
|
||||
try:
|
||||
import pymysql as MySQLdb
|
||||
MySQLdb.install_as_MySQLdb()
|
||||
except ImportError:
|
||||
# MySQLdb is compatible with Python 2 only. Try it as a
|
||||
# fallback if pymysql is unavailable.
|
||||
import MySQLdb
|
||||
|
||||
import traceback
|
||||
|
||||
class SqlConfigParser(MultiOrderedConfigParser):
|
||||
@@ -61,9 +68,6 @@ class SqlConfigParser(MultiOrderedConfigParser):
|
||||
"""Write configuration information out to a file"""
|
||||
try:
|
||||
self.write_dicts(config_file, self._sections)
|
||||
except Exception,e:
|
||||
print "Could not open file ", config_file, " for writing"
|
||||
except:
|
||||
print("Could not open file " + config_file + " for writing")
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user