organizing many python scripts, in a large corporate environment.

eryksun () eryksun at gmail.com
Mon Mar 14 01:52:54 EDT 2011


On Sunday, March 13, 2011 7:27:47 PM UTC-4, bukzor wrote:

>      e) create custom boilerplate in each script that addresses the
> issues in a-d. This seems to be the best practice at the moment...

The boilerplate should be pretty simple. For example, if the base path is the parent directory, then the following works for me:

import os.path
import sys
base = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, base)

Of course, you need to have the __init__.py in each subdirectory.



More information about the Python-list mailing list