[Tutor] trouble using 2to3.py

Richard D. Moores rdmoores at gmail.com
Tue Nov 3 13:12:37 CET 2009


And here's the same try (without the -w switch, to keep it simple),
but this time on my laptop (64-bit Vista SP1). The result is a bit
different:

=====================================
C:\Python31\temp>2to3.py mycalc.py
Traceback (most recent call last):
  File "C:\Python31\temp\2to3.py", line 2, in <module>
    from lib2to3.main import main
  File "C:\Python31\temp\lib2to3\main.py", line 121
    print("At least one file or directory argument required.", file=sys.stderr)
                                                                   ^
SyntaxError: invalid syntax

C:\Python31\temp>python
Python 3.1.1 (r311:74483, Aug 17 2009, 16:45:59) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 1/4
0.25
>>>
==========================================

Dick

On Tue, Nov 3, 2009 at 02:15, Richard D. Moores <rdmoores at gmail.com> wrote:
> Well, here's the same try again, followed by starting the shell:
>
> =========================================
> E:\Python31\temp>2to3.py -w mycalc.py
> Traceback (most recent call last):
>  File "E:\Python31\temp\2to3.py", line 2, in <module>
>    from lib2to3.main import main
>  File "E:\Python31\temp\lib2to3\main.py", line 33
>    except os.error as err:
>                     ^
> SyntaxError: invalid syntax
>
> E:\Python31\temp>python
> Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>>
> ==========================================
>
> Otherwise, how can I tell?
>
> BTW I'm doing this on my old desktop, which runs XP SP2 32-bit.
>
> And thanks, Luke, I took some time off to get back to my piano playing
> with a new teacher, my 6th IIRC. Now its time to do both.
>
> Dick
>
> On Tue, Nov 3, 2009 at 01:50, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
>> Are you sure you're using the 3.1 version of Python to run the script?
>> Welcome back, btw.  haven't heard from you in a while.
>>
>> On Tue, Nov 3, 2009 at 2:09 AM, Richard D. Moores <rdmoores at gmail.com>
>> wrote:
>>>
>>> I'm in the process to learning Python 3.1, and need to convert a bunch
>>> of handy functions I wrote and stole over several years. They are all
>>> written in 2.x, and are together in one file, mycalc.py.
>>>
>>> I created a folder E:\Python31\temp\ (my OS is Vista SP1 64-bit), and
>>> in it I placed copies of mycalc.py, 2to3.py, and a folder, lib2to3\  .
>>>
>>> Then I tried
>>> E:\Python31\temp>2to3.py -w mycalc.py
>>>
>>> and got
>>>
>>> Traceback (most recent call last):
>>>  File "E:\Python31\temp\2to3.py", line 2, in <module>
>>>    from lib2to3.main import main
>>>  File "E:\Python31\temp\lib2to3\main.py", line 33
>>>    except os.error as err:
>>>                     ^
>>> SyntaxError: invalid syntax
>>>
>>> How have others dealt with this?
>>>
>>> Dick Moores
>>> _______________________________________________
>>> Tutor maillist  -  Tutor at python.org
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>


More information about the Tutor mailing list