OpenSIPS / opensips-cli

OpenSIPS CLI tool - an interactive command line tool that can be used to control and monitor OpenSIPS servers.
GNU General Public License v3.0
89 stars 49 forks source link

Error: opensips-cli -x database create #134

Open rotjian opened 3 weeks ago

rotjian commented 3 weeks ago

When I use Ubuntu >= 22.02 in aws platform, I cannot create database through this command. When I use ubuntu 20.*, there is no such kind of issue.

The code is just like following,

opensips-cli -x database create Password for admin MySQL user (root): Traceback (most recent call last): File "/usr/local/bin/opensips-cli", line 4, in import('pkg_resources').run_script('opensipscli==0.2.0', 'opensips-cli') File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 656, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1453, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/EGG-INFO/scripts/opensips-cli", line 9, in run_console() File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/EGG-INFO/scripts/opensips-cli", line 6, in run_console main.main() File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/main.py", line 78, in main sys.exit(shell.cmdloop()) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/cli.py", line 247, in cmdloop ret = self.run_command(module, command, modifiers, params) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/cli.py", line 409, in run_command return mod[0].invoke(cmd, params, modifiers) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/module.py", line 36, in invoke return f(params, modifiers) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/modules/database.py", line 669, in do_create db = self.get_db(admin_url if engine != 'sqlite' else db_url, db_name) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/modules/database.py", line 945, in get_db return osdb(db_url, db_name) File "/usr/local/lib/python3.10/dist-packages/opensipscli-0.2.0-py3.10.egg/opensipscli/db.py", line 214, in init self.conn = self.engine.connect().\ File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 3204, in connect return self._connection_cls(self, close_with_result=close_with_result) File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 96, in init else engine.raw_connection() File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 3283, in raw_connection return self._wrap_pool_connect(self.pool.connect, _connection) File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 3250, in _wrap_pool_connect return fn() File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 310, in connect return _ConnectionFairy._checkout(self) File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 868, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 476, in checkout rec = pool._do_get() File "/usr/lib/python3/dist-packages/sqlalchemy/pool/impl.py", line 145, in _do_get with util.safereraise(): File "/usr/lib/python3/dist-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 207, in raise_ raise exception File "/usr/lib/python3/dist-packages/sqlalchemy/pool/impl.py", line 143, in _do_get return self._create_connection() File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 256, in _create_connection return _ConnectionRecord(self) File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 371, in init self.connect() File "/usr/lib/python3/dist-packages/sqlalchemy/pool/base.py", line 679, in connect )._exec_w_sync_on_first_run(self.dbapi_connection, self) File "/usr/lib/python3/dist-packages/sqlalchemy/event/attr.py", line 329, in _exec_w_sync_on_first_run self(*args, *kw) File "/usr/lib/python3/dist-packages/sqlalchemy/event/attr.py", line 343, in call fn(args, **kw) File "/usr/lib/python3/dist-packages/sqlalchemy/engine/create.py", line 670, in on_connect do_on_connect(dbapi_connection) File "/usr/lib/python3/dist-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 176, in on_connect cursor.execute("SET NAMES %s" % charset_name) File "/usr/local/lib/python3.10/dist-packages/mysqlclient-1.3.14-py3.10-linux-x86_64.egg/MySQLdb/cursors.py", line 255, in execute self.errorhandler(self, exc, value) File "/usr/local/lib/python3.10/dist-packages/mysqlclient-1.3.14-py3.10-linux-x86_64.egg/MySQLdb/connections.py", line 50, in defaulterrorhandler raise errorvalue File "/usr/local/lib/python3.10/dist-packages/mysqlclient-1.3.14-py3.10-linux-x86_64.egg/MySQLdb/cursors.py", line 252, in execute res = self._query(query) File "/usr/local/lib/python3.10/dist-packages/mysqlclient-1.3.14-py3.10-linux-x86_64.egg/MySQLdb/cursors.py", line 378, in _query db.query(q) File "/usr/local/lib/python3.10/dist-packages/mysqlclient-1.3.14-py3.10-linux-x86_64.egg/MySQLdb/connections.py", line 280, in query _mysql.connection.query(self, query) SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Thanks for helping! It seems aws dosen't provide ubuntu 20 anymore!

rotjian commented 3 weeks ago

It seems it's only a problem in ubuntu 22. When I use the newest ubuntu Version 24.04. The problem got solved.