[Tutor] Import from project's lib directory?

Alan Gauld alan.gauld at btinternet.com
Thu Aug 28 23:36:56 CEST 2014


On 28/08/14 19:03, leam hall wrote:
> python 2.4.3 on Red Hat Linux.
>
> I'm starting a project and want to break the scripts into "input",
> "output", and "ddl". I'd like to have a "lib" library directory for
> local modules. The library directory would be at the same level as the
> others.
>
> How do I get the library modules?

Add lib to the sys.path list?

That may not be viable if you need it to be portable across systems, 
although using os.getcwd to locate the current folder or an
environment variable to store the app root folder might be
options there.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list