[Tutor] trouble using 2to3.py
Dave Angel
davea at ieee.org
Tue Nov 3 23:29:18 CET 2009
Tim Golden wrote:
> Richard D. Moores wrote:
>> On Tue, Nov 3, 2009 at 05:30, Dave Angel <davea at ieee.org> wrote:
>>> <snip>
>>> 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?
>
> As an alternative, I've created python26.exe, python31.exe etc. in my
> c:\tools directory (which is on my PATH wherever I am) and which are
> hardlinks to their corresponding c:\python26\python.exe etc.
> Same as the batch file, really, only without a batch file!
>
> TJG
I've thought of using hard links (using fsutil.exe, in case anyone else
is interested), but I keep my scripts and batch files, as well as small
utilities on a separate drive partition from the one that has my OS and
installed programs. And hard links don't work across separate partitions.
But tell me, how does python.exe find its "home" directory, to set
initial sys.path and suchlike? I assumed it was done relative to the
python.exe's full path location. But if you hard link, nobody knows
where the real executable image resides (and in fact the concept has no
meaning, since the two directory entries equally own the content).
I once downloaded a program (which worked on many python scripts, but
not all) which was written as a standin for python.exe, loading the
pythonNN.dll and executing the script. The intentional difference was
that instead of getting the script name from the commandline, it used
its own name as the name of the script, and searched in the same
directory for that script. So effectively if you made a copy of this
program and called it doit.exe, when it ran it would find doit.py and
run that script.
One advantage it conferred is that the tasklist now identifies your
program by name, instead of just having an anonymous python.exe running
one (or six) instances.
I don't remember what it was called, but I'd love to play with it
further. And now I'd like to know how it could know where the lib files
and suchlike are, as well.
DaveA
More information about the Tutor
mailing list