[Tutor] __init__.py for running a file from commandline?
Luke Paireepinart
rabidpoobear at gmail.com
Fri Nov 10 15:46:37 CET 2006
Marcus Goldfish wrote:
> Hoping someone can help with this...
>
> I have a logical python namespace using a directory tree and
> __init__.py files. For example, PYTHONPATH points to ~pyroot, and I
> have the following:
>
> ~pyroot/
> ~pyroot/utils/
> ~pyroot/utils/commands/mygrep.py
>
> Which makes it nice to code:
>
> # some python script
> import utils.commands.mygrep as grep
>
> However, I have a problem when running python scripts from the command
> line. I would like to do this:
>
> > python utils.commands.mygrep.py <http://utils.commands.mygrep.py>
Well, there's no way for Python to know that you want the dots to
specify subdirectories,
and not part of the filename,is there?
I guess you'd have to change into that directory to run the script.
>
> but it doesn't work. Is there a trick, or something that I am
> missing, that will let me run scripts like that?
>
> Thanks!
> Marcus
>
> ps-- WinXP, python 2.4
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list