from . import connections # noqa: E402

688 views
Skip to first unread message

Nic_H

unread,
Apr 8, 2021, 1:46:40 PM4/8/21
to PyMySQL Users
I have this error when using python 3.6 and  some versions of PyMySQL (1.0 .2  and 0.9 for sure) .

If I revert to 0.7 I don't see the error .
As per the official documentation python 3 should work fine with PyMySQL latest 
What am I doing wrong ? 

   "exception": "Traceback (most recent call last):\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617851120.9109116-4948-176725674936972/AnsiballZ_mysql_db.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617851120.9109116-4948-176725674936972/AnsiballZ_mysql_db.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1617851120.9109116-4948-176725674936972/AnsiballZ_mysql_db.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_mysql_db_payload_0F9Tf9/__main__.py\", line 110, in <module>\n  File \"/tmp/ansible_mysql_db_payload_0F9Tf9/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py\", line 33, in <module>\n  File \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/__init__.py\", line 59, in <module>\n    from . import connections  # noqa: E402\n  File \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/connections.py\", line 167\n    *,\n     ^\nSyntaxError: invalid syntax\n",

Nic_H

unread,
Apr 8, 2021, 2:34:41 PM4/8/21
to PyMySQL Users
trying 0.10 returns: 

 from . import _auth\n  File \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/pymysql/_auth.py\", line 10, in <module>\n
                                     from cryptography.hazmat.backends import default_backend\n 
                                      File \"/opt/venvs/py3_ansible28/lib/python3.6/site-packages/cryptography/hazmat/backends/__init__.py\", line 7\n
                                          _default_backend: typing.Any = None\n 
                                                             ^\nSyntaxError: invalid syntax\n
Message has been deleted

Nic_H

unread,
Apr 8, 2021, 2:37:30 PM4/8/21
to PyMySQL Users
Which PYMYSQL version is stable to use with python 3.6 ? 

Inada Naoki

unread,
Apr 8, 2021, 8:04:26 PM4/8/21
to PyMySQL Users
Both SyntaxError is raised for syntax supported by Python 3.
You are using Python 2. Check your environment.

Nic_H

unread,
Apr 8, 2021, 8:16:22 PM4/8/21
to PyMySQL Users
right, my ansible was still using python2 even though I set up a virtual environment with python3  , I forced the interpreter in my config to use python3 and the errors went away , thanks
Reply all
Reply to author
Forward
0 new messages