[Distutils] Import error from Trac for Setuptools

chtaylo3 chtaylo3 at vt.edu
Thu Jul 20 23:18:47 CEST 2006

Hello all,

I'm running Tracd as a normal user.  When I try and access the tracd server 
from a remote computer, I get the error mentioned at the end of this post.  It 
looks like a new Workset object is being created with no parameters.  So 
because entries==NONE then entires=sys.path in the constructor.  It then calls 
add_entry  which calls find_distributions().  Somehow (I'm not sure how), we 
get into find_on_path where os.listdir() is called, and this is where it blows 

>From the errors given, it looks like it's trying to do a listdir on the 
contents of /usr/bin and it get's into permissions trouble.  However, /usr/bin 
is not part of $PYTHONPATH and therefore should not be in the results returned 
from sys.path.

When I run python from the shell, and import sys and then do a sys.path I get 
the following output:

['', '/usr/lib/python2.4/site-packages/setuptools-0.6b4-py2.4.egg', 
'/usr/lib/python2.4', '/usr/local/lib/svn-python', 
'/usr/local/lib/svn-python/svn', '/usr/local/lib/svn-python/libsvn', 
'/usr/lib/python24.zip', '/usr/lib/python2.4/plat-linux2', 
'/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', 

So I have two questions

1) From a simple import command, how are we getting into find_on_path when 
it's find_distributions that is being called?
2) What could have interjected the /usr/bin dir into the $PYTHONPATH variable 
that reuslts in us calling listidr on /usr/bin?

Thank you for your help,

Below is the error:

Exception happened during processing of request from ('', 1543)
Traceback (most recent call last):
  File "/usr/lib/python2.4/SocketServer.py", line 463, in 
    self.finish_request(request, client_address)
  File "/usr/lib/python2.4/SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.4/SocketServer.py", line 521, in __init__
  File "/usr/lib/python2.4/BaseHTTPServer.py", line 314, in handle
  File "/usr/lib/python2.4/BaseHTTPServer.py", line 308, in handle_one_request
  File "/usr/lib/python2.4/site-packages/trac/web/standalone.py", line 259, in 
  File "/usr/lib/python2.4/site-packages/trac/web/standalone.py", line 285, in 
    env = get_environment(req, opts)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 335, in 
    return _open_environment(env_path, threaded)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 51, in 
    env_cache[env_path] = open_environment(env_path)
  File "/usr/lib/python2.4/site-packages/trac/env.py", line 374, in 
    env = Environment(env_path)
  File "/usr/lib/python2.4/site-packages/trac/env.py", line 85, in __init__
    from trac.loader import load_components
  File "/usr/lib/python2.4/site-packages/trac/loader.py", line 21, in ?
    import pkg_resources
, line 2470, in ?
    working_set = WorkingSet()
, line 343, in __init__
, line 358, in add_entry
    for dist in find_distributions(entry, True):
, line 1577, in find_on_path
    for entry in os.listdir(path_item):
OSError: [Errno 13] Permission denied: '/usr/bin'

More information about the Distutils-SIG mailing list