maintain 2 versions of python on my computer
Duncan Booth
duncan.booth at invalid.invalid
Sat Jan 16 17:31:18 EST 2010
Mike <mike at mhuffman.com> wrote:
>> That seems overkill. This does pretty much the same thing:
>>
>> @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
>> import sys
>> print sys.version
>> # raise RuntimeError # uncomment to trigger the 'pause'
>>
>
> Indeed! Must be as close to a "Windows shebang line" as you can get.
>
> In actual use, if/when I want a pause, I typically make a call
> raw_input() or msvcrt.getch()
Right, but that doesn't help if you have an uncaught exception. Personally
I run scripts from a command window so I don't care whether they pause or
not, but since your example had a pause I thought I'd throw one in too.
>
>> EOF is a special label which may be used to exist a CMD file without
>> having to explicitly define it.
>
> Did not know that; something new for my toolbox!
>
s/exist/exit/
There's a surprising amount you can do in a windows cmd or bat file, it's
just that the syntax is so archane.
More information about the Python-list
mailing list