prompt-toolkit / prompt-toolkit/python-prompt-toolkit

AttributeError: 'Stdout' object has no attribute 'isatty' in vt100.py

Open
#1,234 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.