[Python-bugs-list] [ python-Bugs-410274 ] sys.prefix isn't always set

noreply@sourceforge.net noreply@sourceforge.net
Wed, 21 Mar 2001 13:44:08 -0800


Bugs item #410274, was updated on 2001-03-21 01:58
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=410274&group_id=5470

Category: Python Interpreter Core
Group: Platform-specific
Status: Open
Priority: 6
Submitted By: Fredrik Lundh (effbot)
Assigned to: Mark Hammond (mhammond)
Summary: sys.prefix isn't always set

Initial Comment:
(2.0 and earlier, Windows only)

it looks like sys.prefix isn't set unless

1) PYTHONHOME is set (either via an environment 
variable, or via a call to Py_SetPythonHome), or

2) lib/os.py (or lib/string.py, in 1.5.2) can be found 
somewhere between the directory your executable is 
found in, and the root.

if neither is set, the path is taken from the 
registry, but sys.prefix is left blank, and code 
depending on sys.prefix (e.g. FixTk.py) no longer 
works.

</F>


----------------------------------------------------------------------

>Comment By: Mark Hammond (mhammond)
Date: 2001-03-21 13:44

Message:
Logged In: YES 
user_id=14198

The main problem here is exactly how to detect it.

If the executable is not in the Python directory there are 
no reasonable hints.  The DLL is always in the system 
directory.  The core path entries may not may not be in the 
home.

But 228685 depends on this too.

The only solution I can come up with is to use the core 
sys.path entries, and one at a time try and see if the root 
could be the parent of one of them.  Any other ideas?  I 
would prefer to not assume another registry entry is 
written by installers.

I will try and write registry docs soon, but this isn't 
really relevant - I agree that sys.prefix should always be 
set, but just not sure how.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-03-21 10:19

Message:
Logged In: YES 
user_id=31435

Boosted priority a notch.  Mark, is this intentional or a 
bug?  You're a bit overdue in writing up the intended rules 
for Windows, and I'm very reluctant to go changing things 
like this myself in the absence of clarity.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=410274&group_id=5470