python 2.1.1 trouble with addsitedir

David Konerding dek at cgl.ucsf.edu
Fri Jul 20 01:56:23 EDT 2001


Hi, I am checking my application's compatibility wiht 2.1.1 and I've
run into a snag.  We use "site.addsitedir" to add a directory to the
loading path.

As an example, the following works just fine on Python-2.1:

[dek at tolkien dek]$ python
Python 2.1 (#2, Jul 19 2001, 20:48:59) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import site
>>> site.addsitedir("/tmp")
>>> 


but running it with 2.1.1 gives the following:

[dek at tolkien Python-2.1.1c1]$ /var/tmp/python/bin/python
Python 2.1.1c1 (#1, Jul 19 2001, 22:49:25) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import site
>>> site.addsitedir("/tmp")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/var/tmp/python/lib/python2.1/site.py", line 100, in addsitedir
    if not dirs_in_sys_path.has_key(sitedircase):
NameError: global name 'dirs_in_sys_path' is not defined

Did some sort of change occur to how global variables behave?
dirs_in_sys_path is defined as a dictionary earlier in the file.

Dave



More information about the Python-list mailing list