prompt-toolkit / prompt-toolkit/python-prompt-toolkit
AttributeError: 'Stdout' object has no attribute 'isatty' in vt100.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hit this error (trace below) running the Asynssh demo code from jonathanslenders. It was working so I don't know what happened.
Anyway, adding this to class Stdout in server.py seems to fix it, but I really don't know what I am doing.
def isatty(s):
return True
Perhaps someone who knows the code could take a look at it?
Traceback (most recent call last):
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/contrib/ssh/server.py", line 89, in _interact
await self.interact(self)
File "ethacli.py", line 65, in interact
prompt_session = PromptSession()
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 466, in init
self.app = self._create_application(editing_mode, erase_when_done)
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 717, in _create_application
application: Application[_T] = Application(
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 310, in init
self.renderer = Renderer(
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/renderer.py", line 362, in init
if not output.responds_to_cpr:
File "/mnt/pycode/ethametcli/venvcli/lib/python3.8/site-packages/prompt_toolkit/output/vt100.py", line 701, in responds_to_cpr
return self.stdout.isatty()
AttributeError: 'Stdout' object has no attribute 'isatty'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Stdout class in server.py and the responds_to_cpr property in vt100.py, following the traceback to understand the missing terminal capability. Reproduce the Asynssh demo failure and verify that the prompt session starts without the AttributeError, including the reported Stdout behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100