[Python-bugs-list] [ python-Bugs-773476 ] import site fails in certain embedding situations

SourceForge.net noreply@sourceforge.net
Fri, 18 Jul 2003 01:06:43 -0700


Bugs item #773476, was opened at 2003-07-18 02:52
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=773476&group_id=5470

Category: None
Group: Python 2.3
Status: Open
>Resolution: Accepted
Priority: 8
Submitted By: Mark Hammond (mhammond)
>Assigned to: Mark Hammond (mhammond)
Summary: import site fails in certain embedding situations

Initial Comment:
In certain situations (python23.dll and python23.zip in
the same dir, no PYTHON related env vars set, no Python
registry values), Python will fail to import site.

Exception is:
import site # loaded from Zip
C:\build\mozilla\dist\bin\python23.zip\site.pyo
'import site' failed; traceback:
Traceback (most recent call last):
  File ".\site.py", line 191, in ?
NameError: name 'sitedir' is not defined

This exception is the result of there being no
"prefixes", so sitedir is never bound to a value. 
This, the del of sitedir fails.

Suggested patch is attached (just setting sitedir to
None before the loop)



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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-18 03:06

Message:
Logged In: YES 
user_id=80475

"sitedir = []" would be a better choice.

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

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