RobFirth / pycoco

Python Tools for CoCo
MIT License
1 stars 0 forks source link

Make Python 3 compatible #6

Closed RobFirth closed 7 years ago

RobFirth commented 7 years ago

http://python3porting.com/differences.html

RobFirth commented 7 years ago

Setup new virtualenv py3 in /Users/berto/anaconda2/envs/py3. can't use source activate py3 on tcsh, so need to switch to bash shell first.

writing a note to myself here so I don't forget

RobFirth commented 7 years ago

as on @SzymonPrajs's machine, get:

%run scripts/test_pycoco.py
  File "/Users/berto/Code/verbose-enigma/pycoco/__init__.py", line 192
    ValueError.__init__(self, *args, **kwargs)
                                              ^
TabError: inconsistent use of tabs and spaces in indentation

need to look at spacing!

RobFirth commented 7 years ago

tabs converted to spaces

RobFirth commented 7 years ago

StandardError not defined in python3. Replaced with Exception reload not builtin, using:

try:
    reload  # Python 2.7
except NameError:
    try:
        from importlib import reload  # Python 3.4+
    except ImportError:
        from imp import reload  # Python 3.0 - 3.3
RobFirth commented 7 years ago

Test suite runs, 2 errors. Caused by name 'unicode' is not defined

RobFirth commented 7 years ago

Fixed unicode issue. Will reopen issue if my python3 tests fail in future