2to3, str, and basestring

2019-09-07 Thread Terry Reedy
2to3 converts syntactically valid 2.x code to syntactically valid 3.x code. It cannot, however, guarantee semantic correctness. A particular problem is that str is semantically ambiguous in 2.x, as it is used both for text encoded as bytes and binary data. To resolve the ambiguity for

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 20:24:10 +, 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 >>> wrote: Thanks, Laura, and others who hav

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
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 wrote: Thanks, Laura, and others who have replied. You're right; python-3-pygame exists in unstable, but has not yet made it to j

Re: 2to3 translation problem

2015-12-12 Thread Terry Reedy
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 porte

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
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 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'l

Re: 2to3 translation problem

2015-12-12 Thread Chris Angelico
On Sun, Dec 13, 2015 at 4:30 AM, 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 :) The easies

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
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 import pygame ImportError: No module named 'pygame' So, p

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
t; 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): >>>>

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
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 >>> import py

Re: 2to3 translation problem

2015-12-12 Thread Peter Otten
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.

Re: 2to3 translation problem

2015-12-12 Thread Mark Lawrence
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

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
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

Re: 2to3 translation problem

2015-12-12 Thread Mark Lawrence
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

2to3 translation problem

2015-12-12 Thread Tony van der Hoff
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

Re: why no 2to3 in my python?

2014-08-20 Thread Terry Reedy
On 8/20/2014 5:30 AM, Frank Millman wrote: "luofeiyu" wrote in message news:53f463c1.5060...@gmail.com... why no 2to3 in my python34,how can i change python 2 into python3? dir d:\Python34\Scripts You will find it in \Python34\Tools\Scripts To find the docs, look for '

Re: why no 2to3 in my python?

2014-08-20 Thread Frank Millman
"luofeiyu" wrote in message news:53f463c1.5060...@gmail.com... > why no 2to3 in my python34,how can i change python 2 into python3? > >dir d:\Python34\Scripts You will find it in \Python34\Tools\Scripts Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

why no 2to3 in my python?

2014-08-20 Thread luofeiyu
why no 2to3 in my python34,how can i change python 2 into python3? >dir d:\Python34\Scripts Volume in drive D is soft Volume Serial Number is 6F34-9A10 Directory of d:\Python34\Scripts 08/18/2014 09:06 AM . 08/18/2014 09:06 AM .. 07/09/2014 09:01

Re: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
On Friday, July 26, 2013 6:19:48 PM UTC-7, John Ladasky wrote: > I'm making progress, but I'm not out of the woods yet. And while I appreciate any comments that may appear here, I've just found the pyglet-users group... https://groups.google.com/forum/#!forum/pyglet-users ...so that's probably

Re: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
I'm making progress, but I'm not out of the woods yet. I'm trying to run some of the programs from the tutorial web pages, and from the pyglet1.2alpha1/examples directory. I've realized that I will probably need to run 2to3 on the many of the latter. The Hello, World

Re: PyGLet, 2to3...?

2013-07-26 Thread John Ladasky
shal. You were right, I was doing a local import of Py2.x code, instead of importing the 2to3-converted code from site-packages. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGLet, 2to3...?

2013-07-26 Thread Kushal Kumaran
ot; for more information. >>>> import pyglet > Traceback (most recent call last): > File "", line 1, in > File "./pyglet/__init__.py", line 276 --^ Your import is attempting to import from your current directory, which

Re: PyGLet, 2to3...?

2013-07-26 Thread Jerry Hill
On Thu, Jul 25, 2013 at 7:49 PM, John Ladasky wrote: > === > > john@john:~/Desktop/pyglet-1.2alpha1$ sudo python3 setup.py install > > [sudo] password for john: > > running install > running build > running build_py > running install_lib > running install_egg_in

PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
ls to print() as shown in the code block below: === if sys.version_info >= (3,): # Automatically run 2to3 when using Python 3 print("Python version is 3.0 or later.") # I added this if _have_setuptools: print("Have setuptools.

Re: Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
On Thursday, July 25, 2013 1:35:43 AM UTC-7, Kushal Kumaran wrote: > Does your python command mean python2 or python3? The setup.py at > https://code.google.com/p/pyglet/source/browse/setup.py seems to run > 2to3 automatically, but that will only happen if you actually use > py

Re: Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-25 Thread Kushal Kumaran
John Ladasky writes: > Followup to my own post: I've made progress with PyGLet. I should mention > that I'm using Ubuntu Linux 13.04 64-bit, in case it matters. > > I tried executing "2to3 -w *.py" on just the files in the directory > pyglet-1.2alpha1/

Re: Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-25 Thread John Ladasky
Followup to my own post: I've made progress with PyGLet. I should mention that I'm using Ubuntu Linux 13.04 64-bit, in case it matters. I tried executing "2to3 -w *.py" on just the files in the directory pyglet-1.2alpha1/pyglet. I then changed back to the pyglet-1.2al

Python3, GUIs, game APIs, PyGLet, 2to3...?

2013-07-24 Thread John Ladasky
up. https://groups.google.com/d/msg/comp.lang.python/J64gfFg3ZKw/hH-lXurR70EJ There may be other Py3-incompatible code in the PyGLet package that I haven't encountered yet. Thus I have looked at the Python docs for the "2to3" utility. 2to3 probably does what I want, except for one th

Re: to a human - about 2to3

2013-05-01 Thread Terry Jan Reedy
On 5/1/2013 10:52 AM, Jennifer Butler wrote: I will start teaching Python to my pupils shortly. I have been looking for materials and have gathered a collection of programs. The problem is they are written in v2 and I have v3 installed in my classroom. I read about the 2to3 conversion program

Re: to a human - about 2to3

2013-05-01 Thread Mark Lawrence
have v3 installed in my classroom. I read about the 2to3 conversion program, but I can’t get it to work. Could you possibly give me a Noddy’s guide to do this? Thanks in anticipation. Jennifer J Here's the help output. I'd guess (as you don't specify exactly what doesn't

Re: to a human - about 2to3

2013-05-01 Thread Tim Golden
On 01/05/2013 15:52, Jennifer Butler wrote: > I will start teaching Python to my pupils shortly. I have been looking > for materials and have gathered a collection of programs. The problem is > they are written in v2 and I have v3 installed in my classroom. I read > about the 2to

Re: to a human - about 2to3

2013-05-01 Thread Chris Angelico
g >> for materials and have gathered a collection of programs. The problem >> is they are written in v2 and I have v3 installed in my classroom. I >> read about the 2to3 conversion program, but I can’t get it to work. >> >> Could you possibly give me a Noddy’s guide

Re: to a human - about 2to3

2013-05-01 Thread Paul Rudin
they are written in v2 and I have v3 installed in my classroom. I > read about the 2to3 conversion program, but I can’t get it to work. > > Could you possibly give me a Noddy’s guide to do this? Perhaps the first thing you should teach your students is how to ask questions :) When y

to a human - about 2to3

2013-05-01 Thread Jennifer Butler
om. I read about the 2to3 conversion program, but I can't get it to work. Could you possibly give me a Noddy's guide to do this? Thanks in anticipation. Jennifer J -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 inscrutable output

2012-05-28 Thread Steven D'Aprano
On Mon, 28 May 2012 09:18:29 -0700, ru...@yahoo.com wrote: > What is this output from 2to3 supposed to mean? > $ cat mysub.py > isinstance (3, (int,float)) > $ 2to3 -f isinstance mysub.py > RefactoringTool: No changes to mysub.py > RefactoringTool: Files that n

2to3 inscrutable output

2012-05-28 Thread ru...@yahoo.com
What is this output from 2to3 supposed to mean? $ cat mysub.py isinstance (3, (int,float)) $ 2to3 -f isinstance mysub.py RefactoringTool: No changes to mysub.py RefactoringTool: Files that need to be modified: RefactoringTool: mysub.py Why does mysub.py need to be modified, and how

Re: 2to3 for 2.7

2012-05-27 Thread ru...@yahoo.com
On 05/27/2012 07:53 AM, Steven D'Aprano wrote: > > On Sat, 26 May 2012 19:37:33 -0700, ru...@yahoo.com wrote: >> >> Is there a list of fixers I can tell 2to3 to use that will limit changes >> >> to things that will continue to run under python-2.7? > >

Re: 2to3 for 2.7

2012-05-27 Thread Steven D'Aprano
On Sat, 26 May 2012 19:37:33 -0700, ru...@yahoo.com wrote: > Is there a list of fixers I can tell 2to3 to use that will limit changes > to things that will continue to run under python-2.7? So you want a 2to2? I suggest you read the Fine Manual and choose the fixers you want to apply yo

Re: 2to3 for 2.7

2012-05-26 Thread highpointe
Here is my SS: 259 71 2451 On May 26, 2012, at 7:37 PM, "ru...@yahoo.com" wrote: > Is there a list of fixers I can tell 2to3 to use that will > limit changes to things that will continue to run under > python-2.7? > > I want to start the 2->3 trip by making my cod

2to3 for 2.7

2012-05-26 Thread ru...@yahoo.com
Is there a list of fixers I can tell 2to3 to use that will limit changes to things that will continue to run under python-2.7? I want to start the 2->3 trip by making my code as py3 compatible (under py2) as possible before going the rest of the way to py3, and having 2to3 help with this se

2to3 change direct import to relative import

2012-05-10 Thread Vincent Vande Vyvre
Hi, I use 2to3 into a python script wich convert all .py files of an application. 2to3 is executed into the same directory as files. All import are now relative import: - --- main_ui.py (original) +++ main_ui.py (refactored) @@ -15,18 +15,18 @@ -from

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 7:08 PM, Joshua Miller wrote: > I've looked there and it didn't worki may've made all the nesscary > changes manually anyways though i'm not sure... What about it didn't work? Have a read of this too - http://wiki.python.org/moin/PortingPythonToPy3k and if you're still

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 5:06 PM, Joshua Miller wrote: > Ok i'm trying to convert https://github.com/rdeaton/spyral to python3 > but i'm at a loss on how to actually use 2to3. Can someone explain > it's proper use to me so i can do the conversion? prefereably where i >

Can someone explain 2to3?

2012-01-14 Thread Joshua Miller
Ok i'm trying to convert https://github.com/rdeaton/spyral to python3 but i'm at a loss on how to actually use 2to3. Can someone explain it's proper use to me so i can do the conversion? prefereably where i can take "C:\Python32\Lib\site-packages\spyral\" and put it in a

Re: 2to3 and maketrans

2011-03-05 Thread Gregory Ewing
use in 3.x. I just wondered whether there was a recommended idiom for using maketrans() on text in 2.7 that 2to3 would translate into str.maketrans(), but it seems not. Instead the solution seems to be to convert to unicode and use its translation method instead. I've since adopted a differen

Re: 2to3 and maketrans

2011-03-03 Thread Martin v. Löwis
Am 04.03.2011 03:21, schrieb Dan Stromberg: > > On Thu, Mar 3, 2011 at 3:46 PM, Martin v. Loewis > wrote: > > That depends on how you chose to represent text in 2.7. > The recommended way for that (also with 3.x in mind) > is that you should use Unicode str

Re: 2to3 and maketrans

2011-03-03 Thread Dan Stromberg
On Thu, Mar 3, 2011 at 3:46 PM, Martin v. Loewis wrote: > That depends on how you chose to represent text in 2.7. > The recommended way for that (also with 3.x in mind) > is that you should use Unicode strings to represent text. > For application programming, I'm sure Unicode is usually preferab

Re: 2to3 and maketrans

2011-03-03 Thread Martin v. Loewis
Am 03.03.2011 07:58, schrieb Gregory Ewing: > What is the recommended way to write code for 2.7 using > maketrans() on text strings in such a way that it will > convert correctly using 2to3? That depends on how you chose to represent text in 2.7. The recommended way for that (also wi

Re: 2to3 and maketrans

2011-03-03 Thread Dan Stromberg
On Wed, Mar 2, 2011 at 10:58 PM, Gregory Ewing wrote: > What is the recommended way to write code for 2.7 using > maketrans() on text strings in such a way that it will > convert correctly using 2to3? > > There seems to be two versions of maketrans in 3.x, one > for text and o

2to3 and maketrans

2011-03-02 Thread Gregory Ewing
What is the recommended way to write code for 2.7 using maketrans() on text strings in such a way that it will convert correctly using 2to3? There seems to be two versions of maketrans in 3.x, one for text and one for bytes. Code that references string.maketrans ends up with the one for bytes

Re: 2to3 chokes on bad character

2011-02-25 Thread Peter Otten
John Machin wrote: > On Feb 25, 12:00 am, Peter Otten <__pete...@web.de> wrote: >> John Machin wrote: > >> > Your Python 2.x code should be TESTED before you poke 2to3 at it. In >> > this case just trying to run or import the offending code file would >>

Re: 2to3 chokes on bad character

2011-02-24 Thread John Machin
On Feb 25, 12:00 am, Peter Otten <__pete...@web.de> wrote: > John Machin wrote: > > Your Python 2.x code should be TESTED before you poke 2to3 at it. In > > this case just trying to run or import the offending code file would > > have given an informative syntax error

Re: 2to3 chokes on bad character

2011-02-24 Thread Terry Reedy
On 2/24/2011 8:11 AM, Frank Millman wrote: future I will run some tests when betas are released, just in case I come up with something. Please do, perhaps more than once. The test suite coverage is being improved but is not 100%. The day *after* 3.2.0 was released, someone reported an unplea

Re: 2to3 chokes on bad character

2011-02-24 Thread Frank Millman
"Peter Otten" <__pete...@web.de> wrote John Machin wrote: Your Python 2.x code should be TESTED before you poke 2to3 at it. In this case just trying to run or import the offending code file would have given an informative syntax error (you have declared the .py file to be

Re: 2to3 chokes on bad character

2011-02-24 Thread Frank Millman
"John Machin" wrote: On Feb 23, 7:47 pm, "Frank Millman" wrote: [snip lots of valuable info] The issue is not that 2to3 should handle this correctly, but that it should give a more informative error message to the unsuspecting user. Your Python 2.x code should be TE

Re: 2to3 chokes on bad character

2011-02-24 Thread Peter Otten
John Machin wrote: > On Feb 23, 7:47 pm, "Frank Millman" wrote: >> Hi all >> >> I don't know if this counts as a bug in 2to3.py, but when I ran it on my >> program directory it crashed, with a traceback but without any indication >> of which

Re: 2to3 chokes on bad character

2011-02-24 Thread John Machin
On Feb 23, 7:47 pm, "Frank Millman" wrote: > Hi all > > I don't know if this counts as a bug in 2to3.py, but when I ran it on my > program directory it crashed, with a traceback but without any indication of > which file caused the problem. > [traceback snip

2to3 chokes on bad character

2011-02-23 Thread Frank Millman
Hi all I don't know if this counts as a bug in 2to3.py, but when I ran it on my program directory it crashed, with a traceback but without any indication of which file caused the problem. Here is the traceback - Traceback (most recent call last): File "C:\Python32\Tools\Scrip

Re: 2to3

2011-02-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, andrea crotti wrote: 2011/2/17 Chris Rebert Actually, so long as you specify a bit more specific versions, e.g.: python2.7 empathy.py python3.1 empathy3.py it should be fine on most *nixes. Windows would of course require a separate, but analogous, batch file or si

Re: 2to3

2011-02-17 Thread andrea crotti
2011/2/17 Chris Rebert > > Actually, so long as you specify a bit more specific versions, e.g.: > > python2.7 empathy.py > python3.1 empathy3.py > > it should be fine on most *nixes. Windows would of course require a > separate, but analogous, batch file or similar. As for porting the > tests the

Re: 2to3

2011-02-17 Thread Chris Rebert
On Thu, Feb 17, 2011 at 2:11 AM, andrea crotti wrote: > What would be an almost automated way to develop for both python 2.x and > 3.x? > Then after that how do I test the various versions with the various python > versions in a portable way? > > I could just have a bash script that calls > > pyt

2to3

2011-02-17 Thread andrea crotti
What would be an almost automated way to develop for both python 2.x and 3.x? 2to3 apparently can only output a diff or write directly on the file (with -w), but why doesn't it output the resulting file for 3.x instead? So for a single python file I tried a makefile like: Makefile

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-02 Thread Stefan Behnel
Terry Reedy, 01.01.2011 23:47: 1. Code running in multiple versions has to be syntactically correct in every detail all versions in order to be compiled without error. However, version specific syntax *can* be used in modules that are conditionally imported and therefore conditionally compiled an

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
ted. I also encourage people to use 2to3. Then this requirement (must be syntactically correct in all Python versions) goes away: it is ok to write source that doesn't compile on Python 3, and still *run* it on Python 3. OTOH, writing code that only supports newer 2.x versions isn

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Terry Reedy
On 1/1/2011 5:07 PM, Martin v. Loewis wrote: >> I think the developers expected that most maintained and updated 2.x >> code, especially code targeted at 3.x also, would be migrated to 2.6+. > > Unfortunately, that assumption has hurt Python 3 migration > significantly. It gave the impression tha

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
>> To support older Python versions, you need to write your own wrapper >> functions for bytes literals that do nothing in Python 2 and convert the >> literal back to a bytes literal in Python 3. That's ugly, but there's no >> other way to do it. > > I think the developers expected that most maint

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Terry Reedy
On 1/1/2011 5:57 AM, Stefan Behnel wrote: Terry Reedy, 01.01.2011 11:08: On 1/1/2011 4:08 AM, Baptiste Lepilleur wrote: Is there a way to mark string literals so that 2to3 automatically prefixes them with 'b'? Is there a simpler trick? Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Baptiste Lepilleur
2011/1/1 Stefan Behnel > Terry Reedy, 01.01.2011 11:08: > > On 1/1/2011 4:08 AM, Baptiste Lepilleur wrote: >> >> Is there a way to mark string literals so that 2to3 automatically >>> prefixes them with 'b'? Is there a simpler trick? >>> >

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Stefan Behnel
Terry Reedy, 01.01.2011 11:08: On 1/1/2011 4:08 AM, Baptiste Lepilleur wrote: Is there a way to mark string literals so that 2to3 automatically prefixes them with 'b'? Is there a simpler trick? Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Terry Reedy
On 1/1/2011 4:08 AM, Baptiste Lepilleur wrote: Is there a way to mark string literals so that 2to3 automatically prefixes them with 'b'? Is there a simpler trick? Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", &

How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Baptiste Lepilleur
Hi, I'm trying to port some network protocol library to Python 3.x, and it defines many bytes literals as plain string. How do you define bytes literals so that the library can be ported to Python 3.x using only 2to3? For example: In python 2.x, I need: self.buffer = '\n'

Re: 2to3 urllib.URLopener -> urllib.request.URLopener

2010-11-01 Thread Terry Reedy
On 11/1/2010 7:23 AM, Chris McDonald wrote: Howdy, I was going through, evaluating how hard a project would be to move over to a hybrid codebase of python2 and python3 using 2to3. I found that while it would convert most other urllib renames and moves, 2to3 currently leaves urllib.URLopener as

2to3 urllib.URLopener -> urllib.request.URLopener

2010-11-01 Thread Chris McDonald
Howdy, I was going through, evaluating how hard a project would be to move over to a hybrid codebase of python2 and python3 using 2to3. I found that while it would convert most other urllib renames and moves, 2to3 currently leaves urllib.URLopener as is, instead of changing it to go via the

Re: 2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Martin v. Loewis
> The default replacement should be really providing a new execfile that > gets the encoding in the first 2 lines and opens it with the proper > encoding set (and properly closes the stream). No. The default replacement should really open the file in binary mode. Regards, Martin -- http://mail.p

2to3 as a unittest

2010-05-06 Thread Vincent Davis
I have used 2to3 from the command line. is there a way to run it as a unittest. Actually I guess my question is; is there a built in utility for running py3 compatibility on source code as a unittest? *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog <http://vincentdavis.

2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Fabio Zadrozny
Right now, it seems that the default implementation of execfile in 2to3 is something as: exec(compile(open(file).read()+"\n", file, 'exec'), globals, locals) But it seems it won't deal with encodings properly... and also, in CPython just making an open without a cl

Re: 2to3 ParseError with UTF-8 BOM

2009-11-13 Thread Gabriel Genellina
En Fri, 06 Nov 2009 14:12:57 -0300, Farshid escribió: On Nov 5, 7:18 pm, Benjamin Peterson wrote: Try the 2to3 distributed in Python 3.1. I get the same error with the 2to3 script in Python 3.1 Reported as http://bugs.python.org/issue7313 -- Gabriel Genellina -- http://mail.python.org

Re: 2to3 on Mac - unknown encoding: mbcs

2009-11-05 Thread Gabriel Genellina
En Thu, 05 Nov 2009 22:50:57 -0300, Skip Montanaro escribió: I tried naively running 2to3 over the SpamBayes source code on my Mac and got this traceback: Traceback (most recent call last): File "/Users/skip/local/lib/python3.2/lib2to3/pgen2/tokenize.py", li

Re: 2to3 ParseError with UTF-8 BOM

2009-11-05 Thread Benjamin Peterson
Farshid gmail.com> writes: > If I remove the BOM then it works fine. Is this expected behavior or a > bug in the 2to3 script? Try the 2to3 distributed in Python 3.1. -- http://mail.python.org/mailman/listinfo/python-list

2to3 on Mac - unknown encoding: mbcs

2009-11-05 Thread Skip Montanaro
I tried naively running 2to3 over the SpamBayes source code on my Mac and got this traceback: Traceback (most recent call last): File "/Users/skip/local/lib/python3.2/lib2to3/pgen2/tokenize.py", line 281, in find_cookie codec = lookup(encoding) LookupErro

2to3 ParseError with UTF-8 BOM

2009-11-05 Thread Farshid
I'm using Python 2.6.2 and when I run the 2to3 script on a file that contains a UTF-8 BOM I get the following error: RefactoringTool: Can't parse : ParseError: bad token: type=55, value='\xef', context=('', (1, 0)) If I remove the BOM then it works fine. Is this exp

Re: what features would you like to see in 2to3?

2009-03-23 Thread Benjamin Peterson
Kay Schluehr gmx.net> writes: > > On 22 Mrz., 20:39, Benjamin Peterson wrote: > > It's GSoC time again, and I've had lots of interested students asking about > > doing on project on improving 2to3. What kinds of improvements and features > > woul

Re: what features would you like to see in 2to3?

2009-03-23 Thread Steve Holden
Kay Schluehr wrote: > On 22 Mrz., 20:39, Benjamin Peterson wrote: >> It's GSoC time again, and I've had lots of interested students asking about >> doing on project on improving 2to3. What kinds of improvements and features >> would you like to see in it which stude

Re: what features would you like to see in 2to3?

2009-03-22 Thread Kay Schluehr
On 22 Mrz., 20:39, Benjamin Peterson wrote: > It's GSoC time again, and I've had lots of interested students asking about > doing on project on improving 2to3. What kinds of improvements and features > would you like to see in it which student programmers could accomplish?

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
>> > It's GSoC time again, and I've had lots of interested students asking >> about >> > doing on project on improving 2to3. What kinds of improvements and >> features >> > would you like to see in it which student programmers could accomplish?

Re: what features would you like to see in 2to3?

2009-03-22 Thread Benjamin Kaplan
On Sun, Mar 22, 2009 at 4:49 PM, Daniel Fetchinson < fetchin...@googlemail.com> wrote: > > It's GSoC time again, and I've had lots of interested students asking > about > > doing on project on improving 2to3. What kinds of improvements and > features > > w

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
> It's GSoC time again, and I've had lots of interested students asking about > doing on project on improving 2to3. What kinds of improvements and features > would you like to see in it which student programmers could accomplish? Last time I used 2to3 (maybe not the latest vers

what features would you like to see in 2to3?

2009-03-22 Thread Benjamin Peterson
It's GSoC time again, and I've had lots of interested students asking about doing on project on improving 2to3. What kinds of improvements and features would you like to see in it which student programmers could accomplish? -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 does not fix FileType from types Module; no replacement?

2009-03-18 Thread R. David Murray
John Roth wrote: > On Mar 18, 5:48 am, Benjamin Peterson wrote: > >   tlink.de> schrieb: > > > > > and I could not find a replacement for 'FileType'. > > > Has this been overlooked? > > > > > Found this thread which does not mention FileType: > > >http://mail.python.org/pipermail/stdlib-sig/2008-

Re: 2to3 does not fix FileType from types Module; no replacement?

2009-03-18 Thread John Roth
On Mar 18, 5:48 am, Benjamin Peterson wrote: >   tlink.de> schrieb: > > > and I could not find a replacement for 'FileType'. > > Has this been overlooked? > > > Found this thread which does not mention FileType: > >http://mail.python.org/pipermail/stdlib-sig/2008-April/thread.html#172 > > > I gues

Re: 2to3 does not fix FileType from types Module; no replacement?

2009-03-18 Thread Benjamin Peterson
tlink.de> schrieb: > and I could not find a replacement for 'FileType'. > Has this been overlooked? > > Found this thread which does not mention FileType: > http://mail.python.org/pipermail/stdlib-sig/2008-April/thread.html#172 > > I guess I just did not see something simple. > Anyone with a hi

2to3 does not fix FileType from types Module; no replacement ?

2009-03-18 Thread mkieverpy
Hello list, just tried the new 3.1a1 release and its 2to3 script on a simple program of mine. The program uses a type check recipe from activestate. The recipe uses 'types.FileType' which is no longer present in 'types' in 3.1a1. 2to3 does not fix and gives no warning. I fou

Re: 2to3 Help?

2009-03-05 Thread Ant
On Jan 15, 6:43 am, "James Mills" wrote: ... > That is a good idea :) Windows teaches you nothing! Not true. Windows teaches you the art of the workaround... -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 Help?

2009-03-05 Thread John Machin
On Mar 5, 6:47 pm, jjh wrote: > On Jan 14, 10:01 pm, marco.m.peter...@gmail.com wrote: [snipped] > Sorry to bring this back up. The correct thing to do is to start a NEW post. Marco's problem is nothing to do with yours. > I'm a newbie trying to run 2to3 on > Window

Re: 2to3 Help?

2009-03-04 Thread jjh
On Jan 14, 10:01 pm, marco.m.peter...@gmail.com wrote: > I have Python 3.0. I tried to use the 2to3 program included with the > interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. > When I try to start it form the Python command line, it says it is a > syntax error.

Re: 2to3 Help?

2009-01-15 Thread Terry Reedy
marco.m.peter...@gmail.com wrote: I have Python 3.0. I tried to use the 2to3 program included with the interpreter to convert some scripts for Python 2.5 to Python 3.0 ones. I believe 2to3 is will work 'best' with files modified to use some new 2.6 features (backported from 3.0) w

Re: 2to3 Help?

2009-01-14 Thread John Machin
On Jan 15, 5:52 pm, marco.m.peter...@gmail.com wrote: > Oh okay. I don't think my Python installation is in PATH yet. I'll try > to add it then. Am I permitted to ask a really silly question? Thanks. Here it is: How much working 2.X code do you have that needs migrating from 2.x to 3.x? Cheers, J

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
s\User>python C:\Python30\Tools\Scripts \2to3.py C:\Python30\testscript.py Thanks a lot alex23. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 Help?

2009-01-14 Thread alex23
On Jan 15, 4:52 pm, marco.m.peter...@gmail.com wrote: > Oh okay. I don't think my Python installation is in PATH yet. I'll try > to add it then. I don't yet have 3.0 installed, but my guess is you'll also need to have 'C:\Python30\Scripts' in your path as well. I'm assuming that's where it resides

Re: 2to3 Help?

2009-01-14 Thread marco . m . petersen
Oh okay. I don't think my Python installation is in PATH yet. I'll try to add it then. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 Help?

2009-01-14 Thread alex23
structions to denote a command prompt. You're not supposed to type it :) In your case '$' == 'C:\Documents and Settings\User>'; just type '2to3.py testscript.py' and it should work (assuming it's location is in your PATH and you have the right handlers set up to launch it) -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >