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 to return error status code
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: pydoc should return non-zero exit code when a query is not found
View: 44967
Assigned To: Nosy List: mixmastamyk, r.david.murray
Priority: low Keywords:

Created on 2009-04-30 01:06 by mixmastamyk, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg86837 - (view) Author: Mike Miller (mixmastamyk) Date: 2009-04-30 01:06
When pydoc is run from the command line and unable to write a file for a
module because of a syntax error, it would be helpful to return a
non-zero status code as a result.

What it does currently:
    C:\>C:\python26\Lib\pydoc.py -w mymod
    problem in .\mymod.py - <type 'exceptions.SyntaxError'>: invalid
syntax (mymod.py, line 1)

    C:\>echo %ERRORLEVEL%
    0

What it should do if an error is found:
    C:\>type doesnt_exist.txt
    The system cannot find the file specified.

    C:\>echo %ERRORLEVEL%
    1


This would allow us to make our build scripts able to react to error
conditions, etc without having to use another script.  Thanks.
msg87261 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-05-05 17:23
This seems like a resonable thing for pydoc to do.  However, I took a
quick look, and pydoc has no notion of error status. Adding one would
require a non-trival refactoring of the code (at least to do it
right...a hackish version might not be too difficult).  

So, I doubt this is going to happen unless you can contribute a patch.

On the other hand, your test suite should be catching any errors pydoc
would catch, so I can't say I really understand your stated reason for
the request.  Unless you are building documentation for packages you
don't maintain?
msg87358 - (view) Author: Mike Miller (mixmastamyk) Date: 2009-05-07 03:28
Ahh, I see ... I didn't explain my issue with much depth in haste.

I don't usually run the test suite when I am in the process of updating
code or docs, only when I'm done, then I check it in.

So I was updating the docs and running pydoc with a local batch file and
proofreading the html output.  If there was an error, the file seem to
update.  

You are right it won't happen in the build process after all, but rather
when I am making repetitive changes locally and using the command line.

I might look into doing it myself, although not sure when I'll have time
to get to it.
History
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50134
2022-01-25 14:23:18iritkatrielsetstatus: open -> closed
superseder: pydoc should return non-zero exit code when a query is not found
resolution: duplicate
stage: needs patch -> resolved
2013-03-28 10:26:46georg.brandlsetversions: + Python 3.4, - Python 3.1, Python 2.7
2009-05-07 03:28:31mixmastamyksetmessages: + msg87358
2009-05-05 17:23:50r.david.murraysetpriority: low
versions: + Python 3.1, Python 2.7, - Python 2.6
nosy: + r.david.murray

messages: + msg87261

stage: needs patch
2009-04-30 01:06:31mixmastamykcreate