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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4