[Python-Dev] Proposal for virtualenv functionality in Python

Glenn Linderman v+python at g.nevcal.com
Sat Feb 20 05:23:36 CET 2010


On approximately 2/19/2010 7:52 PM, came the following characters from 
the keyboard of Eric Smith:
> Glenn Linderman wrote:
>> On approximately 2/19/2010 1:18 PM, came the following characters 
>> from the keyboard of P.J. Eby:
>>> At 01:49 PM 2/19/2010 -0500, Ian Bicking wrote:
>>>> I'm not sure how this should best work on Windows (without symlinks,
>>>> and where things generally work differently), but I would hope if
>>>> this idea is more visible that someone more opinionated than I would
>>>> propose the appropriate analog on Windows.
>>>
>>> You'd probably have to just copy pythonv.exe to an appropriate
>>> directory, and have it use the configuration file to find the "real"
>>> prefix.  At least, that'd be a relatively obvious way to do it, and it
>>> would have the advantage of being symmetrical across platforms: just
>>> copy or symlink pythonv, and make sure the real prefix is in your
>>> config file.
>>>
>>> (Windows does have "shortcuts" but I don't think that there's any way
>>> for a linked program to know *which* shortcut it was launched from.)
>>
>> No automatic way, but shortcuts can include parameters, not just the 
>> program name.  So a parameter could be --prefix as was suggested in 
>> another response, but for a different reason.
>
> Shortcuts don't work from the shell (well, cmd.exe, at least), do 
> they? Can't test from here.

So if you can't test it, why would you state it as a fact... and then 
back-pedal?  :)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

d:\>python.exe
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> exit()

d:\>c:\python26\python.exe
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> exit()

d:\>d:\python.exe.lnk

d:\>ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>>

So this makes it look like it works fine.  But doing exit() from the 
shortcut-started python fails... it hangs, eventually the whole CMD 
shell dies, if you poke it enough.  I'm going to let it sit there a long 
time ... until I shut down, and see if it ever exits properly.

The form

d:\>start python.exe.lnk

gives the python its own window, and that works/exits fine.

So, shortcuts do work from the shell, but there might be some issues, 
and you might have to type the .lnk to invoke them (I haven't played 
with adding .lnk or .exe.lnk to PATHEXT)

I don't have a clue if the above problem is a Windows issue, or a Python 
issue.

-- 
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking



More information about the Python-Dev mailing list