Can't Install With Python 3 #121

Closed
April29th opened this Issue Oct 3, 2012 · 6 comments

6 participants

@April29th

When I sudo python3 setup.py install on the commandline, I get this error:

Traceback (most recent call last):
File "setup.py", line 25, in
version_tuple = import('pymysql').VERSION
File "/home/forrest/Downloads/pymy/pymysql/init.py", line 28, in
from constants import FIELD_TYPE
ImportError: No module named constants

@pkarc

the same here.

@pkarc

look at this: #135

@boycer

Same isse but worked around it by copying the version tuple into the setup.py file and commenting out the problematic line:

#version_tuple = import('pymysql').VERSION
version_tuple = (0, 5, None)

not ideal....

@oscargilfc

The problem is files are designed for python2

first you have to change
'''python
#version_tuple = import('pymysql').VERSION
version_tuple = (0, 5, None)
'''
then you can build and install.

Later to import you have to change many sintax like relative imports
'''
#from constants import FIELD_TYPE
from .constants import FIELD_TYPE
'''

Change all print expressions to print() function

Change all exceptions expression to Exception()

Tell '''unicode=str''' and '''StandardError=Exception'''

There are many things to change:
http://python3porting.com/differences.html

There should be a python3 branch of this.

@lecram
PyMySQL member

As of now PyMySQL works on Python 3.3.
Python 3.1 & 3.2 are not supported though.
Here is a list of test results on supported versions of Python: https://travis-ci.org/PyMySQL/PyMySQL.

@lecram lecram closed this Sep 21, 2013
@kennknowles

Can you please issue a new release to pypi and comment here? The current release does not work with Python 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment