importing modules

Dave Angel davea at davea.name
Tue Jul 30 11:37:48 EDT 2013


On 07/29/2013 05:57 PM, syed khalid wrote:
> I am attempting to import modules from Shogun to python from a non-standard
> python directory ie from my /home/xxx directory. is there a way on ubuntu
> to selectively some modules, scripts, data  from one directory and others
> modules, scripts from another directory. In other words, is there a file(s)
> that provide pointers to where these modules are located.
>

Your question is confusing, but the short answer is that import will 
search the sys.path list for you.  So in your main script, you can add a 
directory to that list,  before doing the imports.

It can also be done with an environment variable, or with the site file, 
but I don't bother.


-- 
DaveA




More information about the Python-list mailing list