You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem is only 2.7.3 (not 3.2.3, 3.3.0), tested on Windows
Command Line Window
>>> help()
...
help> _
The _ is blinking, waiting for input.
IDLE Shell
>>> help()
...
help>
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
help()
File "C:\Programs\Python27\lib\site.py", line 467, in __call__
return pydoc.help(*args, **kwds)
File "C:\Programs\Python27\lib\pydoc.py", line 1750, in __call__
self.interact()
File "C:\Programs\Python27\lib\pydoc.py", line 1762, in interact
request = self.getline('help> ')
File "C:\Programs\Python27\lib\pydoc.py", line 1773, in getline
return raw_input(prompt)
UnsupportedOperation: readline
There is no blinking _, at that is from the raw_input() call that failed. There is no problem with help() in IDLE for 3.2, 3.3.
I see two possibilities:
This has nothing to do with Idle directly, but is a problem with pythonw and raw_input/readline that was later fixed.
This is a result of how stdin is proxied by Idle and that there is a difference between 2.7 and 3.x.
builtin_raw_input in bltinmodule.c calls
s = PyOS_Readline(PyFile_AsFile(fin), PyFile_AsFile(fout), prompt);
and I presume PyOS_Readline eventually calls fin.readline()
UnsupportedOperation is defined (in 2.7, at least) in _pyio.py
_pyio._unsupported(self, name) raises it with names.
That in turn is the default body for every operation. In particular,
def readline(self):
self._unsupported("readline")
So I presume 2. is the problem and the proxy in the pythonw process is an io subclass that needs readline defined for help() to work.
(Is proxying same on all OSes? Or would problem be Windows only?)
Terry, I am unable to reproduce this error under Win7 Ultimate (no SP1) with either the 32-bit or 64-bit install of 2.7.3. Calling help() produces an interactive prompt in all my test cases. I launched IDLE from the start menu shortcut, with "python.exe -m idlelib.idle", and "pythonw.exe -m idlelib.idle".
Running IDLE without a subprocess doesn't trigger the bug either.
IDLE 2.7.3 works as well on Arch Linux with 2.7.3 (64-bit).
(Also, I get a blinking vertical bar for the cursor, not an underscore on Win7. This minor detail is likely not relevant, only provided since it is an observed difference.)
Does raw_input() work from a regular python shell for you?
changed the title [-]Help() fails at raw_input readline (IDLE 2.7.3, Win7, pythonw)[/-][+]sys.stdin.readline 'unsupported' (IDLE 2.7.3, Win7, pythonw)[/+]on Oct 16, 2012
What type of sys.stdin? Try run in "no subprocess" mode (-n).
serwy commented on Oct 16, 2012
serwymannequin
Mannequin
More actions
I am running 2.7.3 from Apr 10, 2012, freshly installed. I still can not reproduce this problem when running IDLE with or without a subprocess.
Is your PyShell.py file the original or was it modified by accident? It may be possible that run.py was modified as well and is failing to register stdin correctly.
Roger, you are partially right -- there are changes, but they were intentional. I updated the idlelib part of my installation to match the repository on July 9 to incorporate the _RPCFile wrapping of of the three stdio files, including this:
>>> import sys
>>> sys.stdin
<idlelib.run._RPCInputFile object at 0x000000000315D320>
Sorry about forgetting this. Anyway, I presume you remember that issue. It seems that there is still a bug either in that update or its interaction with other code. What happens in linux with a fresh 2.7 build?
Serhiy's patch for bpo-9290 replaces _RPCXyxFile with PseudoXyzFile subclasses of revised PseudoFile. If it works, it should fix this issue also.
serwy commented on Oct 16, 2012
serwymannequin
Mannequin
More actions
Terry, your idlelib directory is in an inconsistent state. IDLE 2.7.3 works well on Arch Linux. I rebuilt it from revision 70274d53c1dd. With and without a subprocess, IDLE's sys.stdin.readline works.
Let's close this issue and focus on bpo-9290. It's your decision to close.
Activity
terryjreedy commentedon Oct 1, 2012
Problem is only 2.7.3 (not 3.2.3, 3.3.0), tested on Windows
Command Line Window >>> help() ... help> _The _ is blinking, waiting for input.
IDLE Shell >>> help() ... help> Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> help() File "C:\Programs\Python27\lib\site.py", line 467, in __call__ return pydoc.help(*args, **kwds) File "C:\Programs\Python27\lib\pydoc.py", line 1750, in __call__ self.interact() File "C:\Programs\Python27\lib\pydoc.py", line 1762, in interact request = self.getline('help> ') File "C:\Programs\Python27\lib\pydoc.py", line 1773, in getline return raw_input(prompt) UnsupportedOperation: readlineThere is no blinking _, at that is from the raw_input() call that failed. There is no problem with help() in IDLE for 3.2, 3.3.
I see two possibilities:
builtin_raw_input in bltinmodule.c calls
s = PyOS_Readline(PyFile_AsFile(fin), PyFile_AsFile(fout), prompt);
and I presume PyOS_Readline eventually calls fin.readline()
UnsupportedOperation is defined (in 2.7, at least) in _pyio.py
_pyio._unsupported(self, name) raises it with names.
That in turn is the default body for every operation. In particular,
def readline(self):
self._unsupported("readline")
So I presume 2. is the problem and the proxy in the pythonw process is an io subclass that needs readline defined for help() to work.
(Is proxying same on all OSes? Or would problem be Windows only?)
serwy commentedon Oct 2, 2012
Terry, I am unable to reproduce this error under Win7 Ultimate (no SP1) with either the 32-bit or 64-bit install of 2.7.3. Calling help() produces an interactive prompt in all my test cases. I launched IDLE from the start menu shortcut, with "python.exe -m idlelib.idle", and "pythonw.exe -m idlelib.idle".
Running IDLE without a subprocess doesn't trigger the bug either.
IDLE 2.7.3 works as well on Arch Linux with 2.7.3 (64-bit).
(Also, I get a blinking vertical bar for the cursor, not an underscore on Win7. This minor detail is likely not relevant, only provided since it is an observed difference.)
Does raw_input() work from a regular python shell for you?
terryjreedy commentedon Oct 16, 2012
Yes, the first part of my post was about how it worked in regular interactive window: prints text, then prompt, then blinking underline cursor.
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 -- Win7 Professional, with all MS patches.
Are you running the apr 10 release or something compiled later, with the readline stub replaced?
Problem manifests in raw_input(): get same behavior of print prompt then crash when should display input cursor.
Problem really is sys.stdin.readline(), which is the dummy stub I quoted in first message.
[-]Help() fails at raw_input readline (IDLE 2.7.3, Win7, pythonw)[/-][+]sys.stdin.readline 'unsupported' (IDLE 2.7.3, Win7, pythonw)[/+]serhiy-storchaka commentedon Oct 16, 2012
Check patch for bpo-9290.
serhiy-storchaka commentedon Oct 16, 2012
What type of sys.stdin? Try run in "no subprocess" mode (-n).
serwy commentedon Oct 16, 2012
I am running 2.7.3 from Apr 10, 2012, freshly installed. I still can not reproduce this problem when running IDLE with or without a subprocess.
Is your PyShell.py file the original or was it modified by accident? It may be possible that run.py was modified as well and is failing to register stdin correctly.
terryjreedy commentedon Oct 16, 2012
Roger, you are partially right -- there are changes, but they were intentional. I updated the idlelib part of my installation to match the repository on July 9 to incorporate the _RPCFile wrapping of of the three stdio files, including this:
+ sys.stdin = self.console = _RPCFile(self.get_remote_proxy("stdin"))
>>> import sys >>> sys.stdin <idlelib.run._RPCInputFile object at 0x000000000315D320>Sorry about forgetting this. Anyway, I presume you remember that issue. It seems that there is still a bug either in that update or its interaction with other code. What happens in linux with a fresh 2.7 build?
Serhiy's patch for bpo-9290 replaces _RPCXyxFile with PseudoXyzFile subclasses of revised PseudoFile. If it works, it should fix this issue also.
serwy commentedon Oct 16, 2012
Terry, your idlelib directory is in an inconsistent state. IDLE 2.7.3 works well on Arch Linux. I rebuilt it from revision 70274d53c1dd. With and without a subprocess, IDLE's sys.stdin.readline works.
Let's close this issue and focus on bpo-9290. It's your decision to close.