Usual practice: running/testing modules in a package

Casey casey.mcginty at
Wed Aug 27 10:21:37 CEST 2008

On Aug 12, 9:57 pm, alito <alito... at> wrote:
> A wrapper on the level up works:
> ~/python$ cat
> from testpackage import config
> config.hello()
> ~/python$ python
> hello
> So, how do I run these modules without writing a wrapper script for
> each one?

I just ran into this problem trying to run a package from a local
directory.  I agree creating another script just to import the local
package is a bad solution. Without another option, I would recommend
using a Makefile and creating a target to import the package and
kickoff the execution:

    python -c 'from testpackage import config; config.hello()'

and then "make hello" to execute the command.

More information about the Python-list mailing list