[Python-Dev] a simpler way to invoke pydoc, pdb, unittest, etc
Jim Fulton
jim at zope.com
Mon Sep 27 10:59:44 CEST 2004
Ilya Sandler wrote:
> A problem:
>
> a number of standard python modules come with a command line interfaces,
> e.g. pydoc.py, pdb.py , unittest.py, timeit.py, uu.py
> But it appears that there is no convenient out-of-the-box way to invoke
> these tools from command line...
>
> Basically one either has to write wrappers or to
> invoke them like this: python /usr/lib/python2.3/pdb.py
>
> Neither approach is convenient...
>
> Am I missing something obvious? If not, then would the following make
> sense?
>
> When a script specified from command line is not found and the script name
> does not end with py, treat the script as a module name and execute
> that module as __main__
>
> So
> python pdb
> would be equivalent to
> python /usr/lib/python2.3/pdb.py
>
> A possible variation of the same idea would be to have an explicit
> command line option -m (or -M). More typing, but less magic...
+1 on the -m command-line variation, with the following change:
I'd like Python to import the module and then run it's main function.
I've been meaning to suggest smething like this myself.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Python-Dev
mailing list