Trying to Learn Packages

Saul Spatz sspatz at kcnet.com
Sun Jun 22 10:07:37 EDT 2008


Hi,

I'm making a project into my first package, mainly for organization, but 
also to learn how to do it.  I have a number of data files, both 
experimental results and PNG files.  My project is organized as a root
directory, with two subdirectories, src and data, and directory trees 
below them.  I put the root directory in my pythonpath, and I've no 
trouble accessing the modules, but for the data, I'm giving relative 
paths, that depend on the current working directory.

This has obvious drawbacks, and hard-coding a directory path is worse. 
Where the data files are numbers, I can simply incorporate them in 
python scripts that initialize data structures , but what can I do with 
the image files?

What is the usual way of dealing with this?

Thanks,
Saul



More information about the Python-list mailing list