Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100335 > unrolled thread

2to3 translation problem

Started byTony van der Hoff <tony@vanderhoff.org>
First post2015-12-12 14:42 +0000
Last post2015-12-12 15:17 -0500
Articles 13 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  2to3 translation problem Tony van der Hoff <tony@vanderhoff.org> - 2015-12-12 14:42 +0000
    Re: 2to3 translation problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-12 15:09 +0000
      Re: 2to3 translation problem Tony van der Hoff <tony@vanderhoff.org> - 2015-12-12 16:31 +0000
        Re: 2to3 translation problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-12 16:56 +0000
        Re: 2to3 translation problem Peter Otten <__peter__@web.de> - 2015-12-12 17:59 +0100
        Re: 2to3 translation problem Laura Creighton <lac@openend.se> - 2015-12-12 18:08 +0100
        Re: 2to3 translation problem Laura Creighton <lac@openend.se> - 2015-12-12 18:09 +0100
          Re: 2to3 translation problem Tony van der Hoff <tony@vanderhoff.org> - 2015-12-12 17:30 +0000
            Re: 2to3 translation problem Chris Angelico <rosuav@gmail.com> - 2015-12-13 04:50 +1100
            Re: 2to3 translation problem Laura Creighton <lac@openend.se> - 2015-12-12 18:54 +0100
              Re: 2to3 translation problem Tony van der Hoff <tony@vanderhoff.org> - 2015-12-12 20:24 +0000
                Re: 2to3 translation problem Laura Creighton <lac@openend.se> - 2015-12-12 22:18 +0100
            Re: 2to3 translation problem Terry Reedy <tjreedy@udel.edu> - 2015-12-12 15:17 -0500

#100335 — 2to3 translation problem

FromTony van der Hoff <tony@vanderhoff.org>
Date2015-12-12 14:42 +0000
Subject2to3 translation problem
Message-ID<dd2q2kFo7m4U1@mid.individual.net>
Debian Jessie, python 2.7; python 3.4

I have an application, using pygame for graphics, that works fine under 
python2.7. I have run it through 2to3, but when running the result under 
python 3.4, I get the error :

Traceback (most recent call last):
   File "ppm304.py", line 9, in <module>
     import pygame
ImportError: No module named 'pygame'

So, python 3.4 can't find the library, whilst python 2.7 can.
How do I track down/fix the missing dependency.

[toc] | [next] | [standalone]


#100336

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-12-12 15:09 +0000
Message-ID<mailman.180.1449932994.12405.python-list@python.org>
In reply to#100335
On 12/12/2015 14:42, Tony van der Hoff wrote:
> Debian Jessie, python 2.7; python 3.4
>
> I have an application, using pygame for graphics, that works fine under
> python2.7. I have run it through 2to3, but when running the result under
> python 3.4, I get the error :
>
> Traceback (most recent call last):
>    File "ppm304.py", line 9, in <module>
>      import pygame
> ImportError: No module named 'pygame'
>
> So, python 3.4 can't find the library, whilst python 2.7 can.
> How do I track down/fix the missing dependency.

This isn't a 2to3 translation problem.  You've installed pygame under 
2.7 at some point, repeat the process for 3.4.  I've no idea how you'd 
do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#100337

FromTony van der Hoff <tony@vanderhoff.org>
Date2015-12-12 16:31 +0000
Message-ID<dd30fqFpqmiU1@mid.individual.net>
In reply to#100336
On 12/12/15 15:09, Mark Lawrence wrote:
> On 12/12/2015 14:42, Tony van der Hoff wrote:
>> Debian Jessie, python 2.7; python 3.4
>>
>> I have an application, using pygame for graphics, that works fine under
>> python2.7. I have run it through 2to3, but when running the result under
>> python 3.4, I get the error :
>>
>> Traceback (most recent call last):
>>    File "ppm304.py", line 9, in <module>
>>      import pygame
>> ImportError: No module named 'pygame'
>>
>> So, python 3.4 can't find the library, whilst python 2.7 can.
>> How do I track down/fix the missing dependency.
>
> This isn't a 2to3 translation problem.  You've installed pygame under
> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>
Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from 
Debian's repository, via apt-get install python-pygame. I believe that 
should be effective for any version of Python.

Thanks anyway,
Tony

[toc] | [prev] | [next] | [standalone]


#100338

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-12-12 16:56 +0000
Message-ID<mailman.181.1449939380.12405.python-list@python.org>
In reply to#100337
On 12/12/2015 16:31, Tony van der Hoff wrote:
> On 12/12/15 15:09, Mark Lawrence wrote:
>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>> Debian Jessie, python 2.7; python 3.4
>>>
>>> I have an application, using pygame for graphics, that works fine under
>>> python2.7. I have run it through 2to3, but when running the result under
>>> python 3.4, I get the error :
>>>
>>> Traceback (most recent call last):
>>>    File "ppm304.py", line 9, in <module>
>>>      import pygame
>>> ImportError: No module named 'pygame'
>>>
>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>> How do I track down/fix the missing dependency.
>>
>> This isn't a 2to3 translation problem.  You've installed pygame under
>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>
> Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from
> Debian's repository, via apt-get install python-pygame. I believe that
> should be effective for any version of Python.
>
> Thanks anyway,
> Tony

My belief is that every package has to be installed in the site-packages 
directory for each version of Python.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#100339

FromPeter Otten <__peter__@web.de>
Date2015-12-12 17:59 +0100
Message-ID<mailman.182.1449939605.12405.python-list@python.org>
In reply to#100337
Tony van der Hoff wrote:

> On 12/12/15 15:09, Mark Lawrence wrote:
>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>> Debian Jessie, python 2.7; python 3.4
>>>
>>> I have an application, using pygame for graphics, that works fine under
>>> python2.7. I have run it through 2to3, but when running the result under
>>> python 3.4, I get the error :
>>>
>>> Traceback (most recent call last):
>>>    File "ppm304.py", line 9, in <module>
>>>      import pygame
>>> ImportError: No module named 'pygame'
>>>
>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>> How do I track down/fix the missing dependency.
>>
>> This isn't a 2to3 translation problem.  You've installed pygame under
>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>
> Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from
> Debian's repository, via apt-get install python-pygame. I believe that
> should be effective for any version of Python.

No, that is the version for Python 2. If there is a Python 3 version it will 
be called

python3-pygame

but no such package seems to be available:

https://packages.debian.org/search?suite=jessie&arch=any&searchon=names&keywords=python3-pygame

[toc] | [prev] | [next] | [standalone]


#100340

FromLaura Creighton <lac@openend.se>
Date2015-12-12 18:08 +0100
Message-ID<mailman.183.1449940119.12405.python-list@python.org>
In reply to#100337
In a message of Sat, 12 Dec 2015 16:31:54 +0000, Tony van der Hoff writes:
>On 12/12/15 15:09, Mark Lawrence wrote:
>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>> Debian Jessie, python 2.7; python 3.4
>>>
>>> I have an application, using pygame for graphics, that works fine under
>>> python2.7. I have run it through 2to3, but when running the result under
>>> python 3.4, I get the error :
>>>
>>> Traceback (most recent call last):
>>>    File "ppm304.py", line 9, in <module>
>>>      import pygame
>>> ImportError: No module named 'pygame'
>>>
>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>> How do I track down/fix the missing dependency.
>>
>> This isn't a 2to3 translation problem.  You've installed pygame under
>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>
>Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from 
>Debian's repository, via apt-get install python-pygame. I believe that 
>should be effective for any version of Python.

You are mistaken here.
python-pygame is only a python 2.7 pygame.

you want python3-pygame.
https://packages.debian.org/search?keywords=python3-pygame

Speaking as a debian user are going to have a _whole lot of this_.
If you don't know about apt-cache search <pkgname> 
let me recommend it to you.

This on debian unstable:

lac@smartwheels:~$  apt-cache search pygame
lightyears - single player real-time strategy game with steampunk sci-fi
psychopy - environment for creating psychology stimuli in Python
python-pygame - SDL bindings for games development in Python
python-pyglet - cross-platform windowing and multimedia library
pyntor - flexible and componentized presentation program
solarwolf - Collect the boxes and don't become mad
python-soya - high level 3D engine for Python
python-soya-dbg - high level 3D engine for Python - debug extension
python-soya-doc - high level 3D engine for Python
python3-pygame - SDL bindings for games development in Python (Python 3)

So, too many hits, alas, but it does tend to find such things.

Laura

[toc] | [prev] | [next] | [standalone]


#100341

FromLaura Creighton <lac@openend.se>
Date2015-12-12 18:09 +0100
Message-ID<mailman.184.1449940195.12405.python-list@python.org>
In reply to#100337
In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes:
>Tony van der Hoff wrote:
>
>> On 12/12/15 15:09, Mark Lawrence wrote:
>>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>>> Debian Jessie, python 2.7; python 3.4
>>>>
>>>> I have an application, using pygame for graphics, that works fine under
>>>> python2.7. I have run it through 2to3, but when running the result under
>>>> python 3.4, I get the error :
>>>>
>>>> Traceback (most recent call last):
>>>>    File "ppm304.py", line 9, in <module>
>>>>      import pygame
>>>> ImportError: No module named 'pygame'
>>>>
>>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>>> How do I track down/fix the missing dependency.
>>>
>>> This isn't a 2to3 translation problem.  You've installed pygame under
>>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>>
>> Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from
>> Debian's repository, via apt-get install python-pygame. I believe that
>> should be effective for any version of Python.
>
>No, that is the version for Python 2. If there is a Python 3 version it will 
>be called
>
>python3-pygame
>
>but no such package seems to be available:
>
>https://packages.debian.org/search?suite=jessie&arch=any&searchon=names&keywords=python3-pygame

There is one in unstable, I forgot to check for jessie, sorry about that.

Laura

[toc] | [prev] | [next] | [standalone]


#100342

FromTony van der Hoff <tony@vanderhoff.org>
Date2015-12-12 17:30 +0000
Message-ID<dd33ufFqmvfU1@mid.individual.net>
In reply to#100341
On 12/12/15 17:09, Laura Creighton wrote:
> In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes:
>> Tony van der Hoff wrote:
>>
>>> On 12/12/15 15:09, Mark Lawrence wrote:
>>>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>>>> Debian Jessie, python 2.7; python 3.4
>>>>>
>>>>> I have an application, using pygame for graphics, that works fine under
>>>>> python2.7. I have run it through 2to3, but when running the result under
>>>>> python 3.4, I get the error :
>>>>>
>>>>> Traceback (most recent call last):
>>>>>     File "ppm304.py", line 9, in <module>
>>>>>       import pygame
>>>>> ImportError: No module named 'pygame'
>>>>>
>>>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>>>> How do I track down/fix the missing dependency.
>>>>
>>>> This isn't a 2to3 translation problem.  You've installed pygame under
>>>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>>>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>>>
>>> Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from
>>> Debian's repository, via apt-get install python-pygame. I believe that
>>> should be effective for any version of Python.
>>
>> No, that is the version for Python 2. If there is a Python 3 version it will
>> be called
>>
>> python3-pygame
>>
>> but no such package seems to be available:
>>
>> https://packages.debian.org/search?suite=jessie&arch=any&searchon=names&keywords=python3-pygame
>
> There is one in unstable, I forgot to check for jessie, sorry about that.
>
> Laura
>
Thanks, Laura, and others who have replied. You're right; 
python-3-pygame exists in unstable, but has not yet made it to jessie, 
even in backports.

So, I'll stick with python 2.7 for the time being; really no hardship :)

[toc] | [prev] | [next] | [standalone]


#100344

FromChris Angelico <rosuav@gmail.com>
Date2015-12-13 04:50 +1100
Message-ID<mailman.185.1449942652.12405.python-list@python.org>
In reply to#100342
On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff <tony@vanderhoff.org> wrote:
> Thanks, Laura, and others who have replied. You're right; python-3-pygame
> exists in unstable, but has not yet made it to jessie, even in backports.
>
> So, I'll stick with python 2.7 for the time being; really no hardship :)

The easiest solution is simply:

python3 -m pip install pygame

Don't worry about it not being in the Jessie repo - you can always
grab things using pip.

ChrisA

[toc] | [prev] | [next] | [standalone]


#100345

FromLaura Creighton <lac@openend.se>
Date2015-12-12 18:54 +0100
Message-ID<mailman.186.1449942871.12405.python-list@python.org>
In reply to#100342
In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes:
>On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff <tony@vanderhoff.org> wrote:
>> Thanks, Laura, and others who have replied. You're right; python-3-pygame
>> exists in unstable, but has not yet made it to jessie, even in backports.
>>
>> So, I'll stick with python 2.7 for the time being; really no hardship :)
>
>The easiest solution is simply:
>
>python3 -m pip install pygame
>
>Don't worry about it not being in the Jessie repo - you can always
>grab things using pip.
>
>ChrisA

What Chris said. :)

If you are about to move your life from being python2.7 based to 
being 3.x, you are not going to be able to depend on things getting
to jessie in a timely fashion.  So you will be doing this a whole lot.

Laura

[toc] | [prev] | [next] | [standalone]


#100349

FromTony van der Hoff <tony@vanderhoff.org>
Date2015-12-12 20:24 +0000
Message-ID<dd3e3aFtakhU1@mid.individual.net>
In reply to#100345
On 12/12/15 17:54, Laura Creighton wrote:
> In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes:
>> On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff <tony@vanderhoff.org> wrote:
>>> Thanks, Laura, and others who have replied. You're right; python-3-pygame
>>> exists in unstable, but has not yet made it to jessie, even in backports.
>>>
>>> So, I'll stick with python 2.7 for the time being; really no hardship :)
>>
>> The easiest solution is simply:
>>
>> python3 -m pip install pygame
>>
>> Don't worry about it not being in the Jessie repo - you can always
>> grab things using pip.
>>
>> ChrisA
>
> What Chris said. :)
>
> If you are about to move your life from being python2.7 based to
> being 3.x, you are not going to be able to depend on things getting
> to jessie in a timely fashion.  So you will be doing this a whole lot.

No:
tony@tony-lx:~$ python3 -m pip install pygame
/usr/bin/python3: No module named pip

Hmm, apt-get install python3-pip: OK

tony@tony-lx:~$ python3 -m pip install pygame
Downloading/unpacking pygame
   Could not find any downloads that satisfy the requirement pygame
   Some externally hosted files were ignored (use --allow-external 
pygame to allow).
Cleaning up...
No distributions at all found for pygame
Storing debug log for failure in /home/tony/.pip/pip.log

I really can't be bothered...

Thanks for the hints.

[toc] | [prev] | [next] | [standalone]


#100352

FromLaura Creighton <lac@openend.se>
Date2015-12-12 22:18 +0100
Message-ID<mailman.191.1449955123.12405.python-list@python.org>
In reply to#100349
In a message of Sat, 12 Dec 2015 20:24:10 +0000, Tony van der Hoff writes:
>On 12/12/15 17:54, Laura Creighton wrote:
>> In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes:
>>> On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff <tony@vanderhoff.org> wrote:
>>>> Thanks, Laura, and others who have replied. You're right; python-3-pygame
>>>> exists in unstable, but has not yet made it to jessie, even in backports.
>>>>
>>>> So, I'll stick with python 2.7 for the time being; really no hardship :)
>>>
>>> The easiest solution is simply:
>>>
>>> python3 -m pip install pygame
>>>
>>> Don't worry about it not being in the Jessie repo - you can always
>>> grab things using pip.
>>>
>>> ChrisA
>>
>> What Chris said. :)
>>
>> If you are about to move your life from being python2.7 based to
>> being 3.x, you are not going to be able to depend on things getting
>> to jessie in a timely fashion.  So you will be doing this a whole lot.
>
>No:
>tony@tony-lx:~$ python3 -m pip install pygame
>/usr/bin/python3: No module named pip
>
>Hmm, apt-get install python3-pip: OK
>
>tony@tony-lx:~$ python3 -m pip install pygame
>Downloading/unpacking pygame
>   Could not find any downloads that satisfy the requirement pygame
>   Some externally hosted files were ignored (use --allow-external 
>pygame to allow).
>Cleaning up...
>No distributions at all found for pygame
>Storing debug log for failure in /home/tony/.pip/pip.log
>
>I really can't be bothered...
>
>Thanks for the hints.

Sorry, I forgot to warn you.  Debian, in its wisdom breaks python
up into several pieces, and so if you install python as a debian
package, you have to install the ability to use pip separately.

apt-get install python-pip  (for 2.x)
apt-get install python3-pip (for 3.x)

Laura

[toc] | [prev] | [next] | [standalone]


#100348

FromTerry Reedy <tjreedy@udel.edu>
Date2015-12-12 15:17 -0500
Message-ID<mailman.188.1449951461.12405.python-list@python.org>
In reply to#100342
On 12/12/2015 12:30 PM, Tony van der Hoff wrote:

> Thanks, Laura, and others who have replied. You're right;
> python-3-pygame exists in unstable, but has not yet made it to jessie,
> even in backports.
>
> So, I'll stick with python 2.7 for the time being; really no hardship :)

pygame itself was ported to 3.x years ago and the port is quite stable.

-- 
Terry Jan Reedy

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web