Python site-packages and import

Maurice LING mauriceling at acm.org
Thu Apr 28 19:49:44 EDT 2005


Peter Saffrey wrote:
> I'm trying to write a python service, with an executable in
> /usr/local/bin, but modules that are kept in a sub-directory of
> /usr/lib/python/site-packages.
> 
> Using apt-proxy as my template, I've put the modules in
> /usr/lib/python/site-packages/mymodules and tried to import them with
> import mymodules.module1. However, this doesn't seem to be working,
> even though something very similar works for apt-proxy. I thought this
> might be something to do with sys.path, but I can't work out why it's
> different for my modules and those used by apt-proxy.
> 
> To be fair, it is past midnight, and I'm probably just being stupid.
> Would anybody care to point out where? :)
> 
> Peter

your site-packages directory must be seen in python. try

import sys
sys.path

and see if your site-packages directory is listed?

maurice



More information about the Python-list mailing list