This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc seems to run some scripts!
Type: Stage:
Components: Demos and Tools Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: bob.ippolito, nnorwitz, olly
Priority: normal Keywords:

Created on 2005-11-04 17:10 by olly, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg26798 - (view) Author: Olly Betts (olly) Date: 2005-11-04 17:10
Ubuntu 5.10 "Breezy Badger"
Linux 2.6.10
Python 2.4.2

Running pydoc on some scripts (for example regextest.py
as supplied with python) just seems to hang:

pydoc
/usr/share/doc/python2.4/examples/Demo/comparisons/regextest.py

Feeding it EOF (Ctrl-D) makes it actually generate
documentation and exit.

But as well as showing the documentation, I get output
which appears to be the script actually having run with
itself as an argument!
msg26799 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-11-08 02:45
Logged In: YES 
user_id=139309

Some scripts are broken, this one is missing a check to see if it's a script 
or a module:
if __name__ == "__main__": main()
msg26800 - (view) Author: Olly Betts (olly) Date: 2005-11-08 11:09
Logged In: YES 
user_id=14972

So I guess this is a bug report for that missing check in
regextest.py in the python distribution.

Is running a script which is missing this check an inherent
feature of how pydoc works then?
msg26801 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-11-08 16:13
Logged In: YES 
user_id=139309

pydoc imports modules, it doesn't run scripts.  It just so happens that 
regextest isn't written correctly and does things it shouldn't do when 
imported.

You should file a new bug on regextest.py, or at least change the summary 
accordingly... but a new bug would end up in the summary again, and 
would be more likely to be fixed.
msg26802 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005-11-09 07:09
Logged In: YES 
user_id=33168

I'm feeling generous tonight. :-)

Thanks for the report.  I updated regextest program.

Committed revision 41414.
Committed revision 41415. (2.4)
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42552
2005-11-04 17:10:42ollycreate