emilmont / pyStatParser

Simple Python Statistical Parser
Apache License 2.0
110 stars 49 forks source link

Added Python 3 support #7

Closed bendavis78 closed 7 years ago

bendavis78 commented 10 years ago

I used python-future to add python3 support, making pyStatParser python2/python3 compatibke.

emilmont commented 10 years ago

Hi Ben, thanks for your contribution.

I quickly tried to run your branch with Python 2.7.5 and it is failing with the following error message:

ImportError: No module named future.builtins

Could you please fix it?

Cheers, Emilio

bendavis78 commented 10 years ago

It seems python-future adds a dependency on itself. I've gone ahead and refactored using six.py, which is a much lighter-weight py2 to py3 library.

williamgilpin commented 8 years ago

@bendavis78 I was able to get your updated version to work in my copy of Python 3 (miniconda). However, I had to go into the source and comment out the following minor issues that appeared when I tried to install from setup.py

The command:

(py3env)william@Williams-MBP-4:~/Downloads/pyStatParser$ python setup.py install

Gives the following traceback:


running install
running build
running build_py
running install_lib
byte-compiling /Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/eval_parser.py to eval_parser.cpython-34.pyc
  File "/Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/eval_parser.py", line 120
    print "%10s  %10s  %10s  %10s   %10s"%(
                                        ^
SyntaxError: invalid syntax

byte-compiling /Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/treebanks/normalize.py to normalize.cpython-34.pyc
  File "/Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/treebanks/normalize.py", line 125
    except UncertainParsing, e:
                           ^
SyntaxError: invalid syntax

byte-compiling /Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/treebanks/parse.py to parse.cpython-34.pyc
  File "/Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/stat_parser/treebanks/parse.py", line 160
    except Exception, e:
                    ^
SyntaxError: invalid syntax

running install_egg_info
Writing /Users/william/miniconda/envs/py3env/lib/python3.4/site-packages/pyStatParser-0.0.1-py3.4.egg-info
brianray commented 7 years ago

@williamgilpin I didn't experience that.

 Writing /Users/brray/anaconda2/anaconda/envs/py3k/lib/python3.5/site-packages/pyStatParser-0.0.1-py3.5.egg-info

from his branch https://github.com/bendavis78/pyStatParser/tree/python3

and still seems to work with python2.7 too

Writing /Users/brray/anaconda2/anaconda/lib/python2.7/site-packages/pyStatParser-0.0.1-py2.7.egg-info

I was able to run example.py with either. I think this is ok to merge.