jobin-sun / raspberry-gpio-python

Automatically exported from code.google.com/p/raspberry-gpio-python
MIT License
0 stars 0 forks source link

Python 3 compatibility via 2to3 #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
0.  Note that RPi.GPIO is marked as compatible to Python 3 on PyPI.
1.  Try to install using pip-3.2:
$ sudo apt-get upgrade
$ sudo apt-get install python3-dev python3-pip
$ sudo pip-3.2 install --upgrade distribute RPi.GPIO

What is the expected output?

pip logs the install of RPi.GPIO

What do you see instead?

pip fails to install RPi.GPIO. Complete log in attachement. Money quote:

Downloading from URL 
http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz#md5
=e55298c7e3a233df1a47a4881a0c9800
  Running setup.py egg_info for package distribute

    Traceback (most recent call last):

      File "<string>", line 3, in <module>

      File "setuptools/__init__.py", line 2, in <module>

        from setuptools.extension import Extension, Library

      File "setuptools/extension.py", line 5, in <module>

        from setuptools.dist import _get_unpatched

      File "setuptools/dist.py", line 103

        except ValueError, e:

                         ^

    SyntaxError: invalid syntax

    Complete output from command python setup.py egg_info:

    Traceback (most recent call last):

  File "<string>", line 3, in <module>

  File "setuptools/__init__.py", line 2, in <module>

    from setuptools.extension import Extension, Library

  File "setuptools/extension.py", line 5, in <module>

    from setuptools.dist import _get_unpatched

  File "setuptools/dist.py", line 103

    except ValueError, e:

                     ^

SyntaxError: invalid syntax

----------------------------------------

Command python setup.py egg_info failed with error code 1 in 
/home/pi/build/distribute

Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 245, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1009, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python3/dist-packages/pip/req.py", line 225, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 256, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with 
error code 1 in /home/pi/build/distribute

What version of the product are you using? On what operating system?

Official Debian Wheezy Image:

$ uname -a
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l 
GNU/Linux

Please provide any additional information below.

Supposed at a workround:

$ wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.1a.tar.gz
$ tar -xvf RPi.GPIO-0.5.1a.tar.gz
$ nano RPi.GPIO-0.5.1a/setup.py # and add "use_2to3 = True," to "setup"
$ sudo python3 RPi.GPIO-0.5.1a/setup.py install

Verification fails:

$ sudo python3
>>> import RPi.GPIO as GPIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named GPIO

Original issue reported on code.google.com by Bengt.Lueers@gmail.com on 17 Mar 2013 at 8:10

Attachments:

GoogleCodeExporter commented 9 years ago
Will be in release 0.5.2a

Original comment by btcros...@googlemail.com on 18 Mar 2013 at 7:42

GoogleCodeExporter commented 9 years ago
Awesome! Looking forward to testing it.

Original comment by Bengt.Lueers@gmail.com on 18 Mar 2013 at 7:55

GoogleCodeExporter commented 9 years ago
Looks like an issue with distribute/pip and not RPi.GPIO.  If you do a pip-3.2 
install --upgrade RPi.GPIO it asks you to easy_install3 -U distribute first.  
RPi.GPIO does not contain any code in python apart from distribute_setup.py so 
adding the 2to3 flag in setup.py will not achieve anything anyway.

To install the latest RPi.GPIO for Python 3 either:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install python3-rpi.gpio

Or:

$ wget  
http://raspberry-gpio-python.googlecode.com/files/python3-rpi.gpio_0.5.1a-1_armh
f.deb
$ sudo dpkg -i python3-rpi.gpio_0.5.1a-1.armhf.deb

Or:

$ sudo easy_install3 -U distribute
$ sudo pip-3,2 install --upgrade RPi.GPIO

I recommend the first method because this way you will not end up with two 
conflicting versions of RPi.GPIO on your system.

Original comment by btcros...@googlemail.com on 19 Mar 2013 at 11:33