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... There is already has been some discussion about importing from command line: http://mail.python.org/pipermail/python-dev/2003-December/041240.html I suggested the following: 1. python -p package Equivalent to: import package 2. python -p package.zip Equivalent to: import sys sys.path.insert(0, "package.zip") import package -- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru
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