#326 closed defect (fixed)
python interactive help does not do CR/NL line endings.
Reported by: | Steven Levine | Owned by: | |
---|---|---|---|
Priority: | Feedback Pending | Milestone: | |
Component: | python | Version: | |
Severity: | low | Keywords: | |
Cc: |
Description
The python interactive mode help facility do not generate CR/NL line endings.
To reproduce, start with
python -i
From the python command line, enter
help('base64')
to request base64 module help.
The output will be paged, but with NL line endings rather than CR/NL line endings.
Change History (5)
comment:1 by , 6 years ago
Priority: | minor → Feedback Pending |
---|
comment:2 by , 6 years ago
This is better.
I recommend changing
if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0:
to
if hasattr(os, 'system') and os.system('less 2>nul') == 0:
It appears that os.system runs the command though the platform shell (aka cmd.exe or 4os2) rather than sh.exe.
If less.exe is not available, this results in
help('base64')
SYS0003: The system cannot find the path specified. "D:\dev\null"
Unknown command "less"
With my mod the SYS0003 goes away.
The more fallback can be improved. Changing to open call in tempfilepager from:
file = open(filename, 'w')
to
file = open(filename, 'wt')
seems to provide the results we want.
comment:3 by , 6 years ago
I will consider this in the next python drop. When this happens is unknown atm.
comment:4 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
this sys0003 is only there, if EXMSHELL is not set to sh. as our standard rpm set this value right, I did not change the sys003 workaround. the rest is done in r1551
comment:5 by , 6 years ago
I can confirm that help() now works as expected with the latest python rpm.
please try the following:
in file /@unixroot/usr/lib/python2.7/pydoc.py change to the following:
be aware that you have less rpm installed. If this works for you as well (works like a charm here) I will make that the default.