Install of 0.3.2 fails with syntax errors for Python 3.2.2

Asked by Devon Campbell on 2012-01-31

Ran the install using Python 3.2.2 on my Mac (Lion) and received errors:

running install
running build
running build_py
creating build
creating build/lib
creating build/lib/mysql
copying python3/mysql/__init__.py -> build/lib/mysql
creating build/lib/mysql/connector
copying python3/mysql/connector/__init__.py -> build/lib/mysql/connector
copying python3/mysql/connector/_version.py -> build/lib/mysql/connector
copying python3/mysql/connector/connection.py -> build/lib/mysql/connector
copying python3/mysql/connector/constants.py -> build/lib/mysql/connector
copying python3/mysql/connector/conversion.py -> build/lib/mysql/connector
copying python3/mysql/connector/cursor.py -> build/lib/mysql/connector
copying python3/mysql/connector/dbapi.py -> build/lib/mysql/connector
copying python3/mysql/connector/errors.py -> build/lib/mysql/connector
copying python3/mysql/connector/protocol.py -> build/lib/mysql/connector
copying python3/mysql/connector/utils.py -> build/lib/mysql/connector
running install_lib
byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/constants.py to constants.pyc
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/constants.py", line 43
    raise TypeError, "Can not instanciate from %s" % cls.__name__
                   ^
SyntaxError: invalid syntax

byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/conversion.py to conversion.pyc
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/conversion.py", line 279
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/errors.py to errors.pyc
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/errors.py", line 78
    except Exception, e:
                    ^
SyntaxError: invalid syntax

byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/protocol.py to protocol.pyc
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/protocol.py", line 51
    except Exception, e:
                    ^
SyntaxError: invalid syntax

byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/utils.py to utils.pyc
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql/connector/utils.py", line 88
    if i < 0 or i > 4294967295L:
                              ^
SyntaxError: invalid syntax

running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql_connector_python-0.3.2_devel-py3.2.egg-info
Writing /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/mysql_connector_python-0.3.2_devel-py3.2.egg-info

Question information

Language:
English Edit question
Status:
Solved
For:
MySQL Connector/Python Edit question
Assignee:
No assignee Edit question
Solved by:
Devon Campbell
Solved:
2012-01-31
Last query:
2012-01-31
Last reply:
2012-01-31

Guessing here, but it looks like you installed the Python v2, and then try to install for Python v3 right after.
Maybe it's good to run setup.py clean or remove the build/ directory.

Devon Campbell (raddevon) said : #2

I had to go into the site-packages directory and manually delete the mysql directory before I could complete the install without errors.

Thank you very much for your help.