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 fails on Python file with nonlocal
Type: crash Stage: resolved
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: r.david.murray, serhiy.storchaka, stevelitt
Priority: normal Keywords:

Created on 2016-01-02 02:15 by stevelitt, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pydoc_fail.py stevelitt, 2016-01-02 02:15 Python source file that produces the Pydoc error. Pydoc error can be toggled by commenting in and out the "nonlocal" line.
Messages (4)
msg257321 - (view) Author: Steve Litt (stevelitt) Date: 2016-01-02 02:15
Latest pydoc on Void linux 64 bit, I have no idea how to capture the version. Source file can be either Python 3.4 or 2.7, same result.

ERROR MESSAGE:

[slitt@mydesk ~]$ pydoc pydoc_fail
problem in ./pydoc_fail.py - <type 'exceptions.SyntaxError'>: invalid syntax (pydoc_fail.py, line 6)

[slitt@mydesk ~]$
msg257322 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-01-02 02:23
Are you sure you are running pydoc using python3?  That error looks like you are running it using python2, as does the command line you show (since on most systems the pydoc command comes from python2).  (I don't know what you mean by "source file can be..."; nonlocal is python3 only.)
msg257323 - (view) Author: Steve Litt (stevelitt) Date: 2016-01-02 03:17
On Sat, 02 Jan 2016 02:23:27 +0000
"R. David Murray" <report@bugs.python.org> wrote:

> R. David Murray added the comment:
> 
> Are you sure you are running pydoc using python3?  That error looks
> like you are running it using python2, as does the command line you
> show (since on most systems the pydoc command comes from python2).
> (I don't know what you mean by "source file can be..."; nonlocal is
> python3 only.)
> 
> ----------
> nosy: +r.david.murray

Thanks R. David,

You indeed got to the crux of the problem. I performed the following
command and everything worked perfectly:

python3 /usr/bin/pydoc pydoc_fail.py

I tried to note on the bug tracker that the problem is solved by using
Python3 to run pydoc and this wasn't a bug, but was unable to add
anything to issue 25990. I saw no "reply" button, and "Edit" was a
label, not a button.

How do I reply on the bug tracker?

Thanks,

Steve

Steve Litt 
November 2015 featured book: Troubleshooting Techniques
     of the Successful Technologist
http://www.troubleshooters.com/techniques
msg257329 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-01-02 06:43
If you have installed Python 3, perhaps you have the /usr/bin/pydoc3 symlink. Just use the pydoc3 command.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70178
2016-01-02 06:43:19serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg257329

resolution: not a bug
stage: resolved
2016-01-02 03:17:56stevelittsetmessages: + msg257323
2016-01-02 02:23:27r.david.murraysetnosy: + r.david.murray
messages: + msg257322
2016-01-02 02:18:23r.david.murraysethgrepos: - hgrepo328
2016-01-02 02:15:52stevelittcreate