organizing your scripts, with plenty of re-use

Ethan Furman ethan at stoneleaf.us
Tue Oct 13 12:37:34 EDT 2009


Buck wrote:

[snip]

> Steven had the nicest workaround (with the location = __import__
> ('__main__').__file__ trick), but none of them solve the problem of
> the OP: organization of runnable scripts. So far it's been required to
> place all runnable scripts directly above any used packages. The
> workaround that Gabriel has been touting requires this too.

[snip]

Wha?  "Place all runnable scripts directly above any used packages?"  I 
must have missed something major in this thread.  The only thing 
necessary is to have the package being imported to be somewhere in 
PYTHONPATH.

Previous post:
 >I'd like to get to zero-installation if possible. It's easy with
 >simple python scripts, why not packages too? I know the technical
 >reasons, but I haven't heard any practical reasons.

I don't think we mean the same thing by "zero-installation"... seems to 
me that if you have to copy it, check it out, or anything to get the 
code from point A to point 'usable on your computer', then you have done 
some sort of installation.

~Ethan~



More information about the Python-list mailing list