0

The Spynner docs says it supports Python >=26, but during installation I get the following error:

(spynner) spynner$ pip3 install spynner
Requirement already satisfied (use --upgrade to upgrade): spynner in /Users/spynner/Envs/spynner/lib/python3.4/site-packages/spynner-2.19-py3.4.egg
Collecting six (from spynner)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting beautifulsoup4 (from spynner)
  Using cached beautifulsoup4-4.5.1-py3-none-any.whl
Collecting unittest2 (from spynner)
  Using cached unittest2-1.1.0-py2.py3-none-any.whl
Collecting pyquery (from spynner)
  Using cached pyquery-1.2.13.tar.gz
Collecting autopy (from spynner)
  Using cached autopy-0.51.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/zl/dpw1svbx2qjbl549qvzq2r640000gn/T/pip-build-3rvrid_c/autopy/setup.py", line 50
        print 'Updating __init__.py'
                               ^
    SyntaxError: Missing parentheses in call to 'print'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/zl/dpw1svbx2qjbl549qvzq2r640000gn/T/pip-build-3rvrid_c/autopy/

So it looks like one of the packages is written for 2.7.

Is there some Python trick I can do to get this to work with Python 3, or do I have to go and manually correct the offending code?

Cheers

Tom Brock
  • 920
  • 7
  • 29
  • Odd ... the source from github looks OK... https://github.com/msanders/autopy/blob/master/setup.py#L56. Perhaps you can try to `pip install` it directly from github? `pip3 install git+https://github.com/msanders/autopy.git` and _then_ install `spynner` (`pip3 install spynner`)? – mgilson Sep 22 '16 at 07:43
  • Unfortunately that produces another error. if (mod == NULL) return; /* Error */ ^ src/autopy-mouse-module.c:87:3: error: non-void function 'initmouse' should return a value [-Wreturn-type] return; ^ 2 errors generated. error: command '/usr/bin/clang' failed with exit status 1 – Tom Brock Sep 22 '16 at 08:30

1 Answers1

0

You will need to correct the offending code. There are automated tools that help you do that, such as 2to3:

2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code. The standard library contains a rich set of fixers that will handle almost all code. 2to3 supporting library lib2to3 is, however, a flexible and generic library, so it is possible to write your own fixers for 2to3. lib2to3 could also be adapted to custom applications in which Python code needs to be edited automatically.

poe123
  • 1,188
  • 8
  • 11