[Tutor] trouble using 2to3.py

Dave Angel davea at ieee.org
Tue Nov 3 22:16:35 CET 2009


Richard D. Moores wrote:
> On Tue, Nov 3, 2009 at 05:30, Dave Angel <davea at ieee.org> wrote:
>   
>> <snip>
>>
>> Easiest way to know which python is being used is to run it same way:
>>
>> e:\python31\temp> python 2to3.py -w mycalc.py
>>
>> Or the way I do it, have python31.bat and python26.bat, which launch the
>> exact pythons that I want.
>>     
>
> Thanks, Dave. I'm not familiar with .bat files. Could you give me a
> look at one of them?
>
> Dick
>
>   
A batch file is Windows (much dummyfied) version of Unix script files.  
It's a "program" interpreted by CMD.EXE, the shell processor for a 
"Command Prompt".   Anyway, it's usually not much more than a list of 
programs to run, with their arguments.  In our case, we just want to run 
a particular python.exe in a particular path, with whatever arguments 
were passed to the batch file.  So mine are one line each, and look like:

python26.bat
-------------------
c:\progfiles\python26\python.exe %*


python31.bat
-------------------
c:\progfiles\python31\python.exe %*


Obviously, yours will be different, unless you happened to pick the same 
install path as I did.  The %* magic just means copy the rest of the 
original command line.

You run these something like:

m:\myscripts\ready >  python31  myprogram.py

to explicitly run python31 on the python script, myprogram.py

DaveA



More information about the Tutor mailing list