Usual practice: running/testing modules in a package
Casey
casey.mcginty at gmail.com
Wed Aug 27 04:21:37 EDT 2008
On Aug 12, 9:57 pm, alito <alito... at gmail.com> wrote:
>
> A wrapper on the level up works:
>
> ~/python$ cat importercaller.py
> from testpackage import config
> config.hello()
>
> ~/python$ python importercaller.py
> 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:
hello:
python -c 'from testpackage import config; config.hello()'
and then "make hello" to execute the command.
More information about the Python-list
mailing list