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
Outputs from os.system or subprocess.call are not captured by textual, and appear at the top-left of the terminal instead.
My goal is to run scripts upon button presses, and to see the scripts' outputs in a Log widget in realtime.
textual diagnose didn't recognize my terminal. I am using Windows Terminal version 1.21.2911.0, but I have the same issue using the legacy terminal (by selecting "Windows Console Host" in Windows 11 settings). The issue is there using PowerShell 7.4.6 or MS-DOS for the terminal. Note that os.system runs MS-DOS.
Here is a video, and the MRE can be found below.
textual.mp4
fromtextual.appimportAppfromtextual.widgetsimportLogimportosclassMyApp(App):
defcompose(self):
yieldLog(id="log")
defon_print(self, event):
self.query_one("#log", Log).write(event.text)
defon_key(self, event):
ifevent.key=='q':
print('q was pressed')
elifevent.key=='w':
os.system("echo w was pressed")
defon_ready(self):
self.begin_capture_print(self, True, True)
if__name__=="__main__":
app=MyApp()
app.run()
Textual Diagnostics
Versions
Name
Value
Textual
0.85.2
Rich
13.9.3
Python
Name
Value
Version
3.12.5
Implementation
CPython
Compiler
MSC v.1940 64 bit (AMD64)
Executable
C:\Program Files\Python312\python.exe
Operating System
Name
Value
System
Windows
Release
11
Version
10.0.22631
Terminal
Name
Value
Terminal Application
Unknown
TERM
Not set
COLORTERM
Not set
FORCE_COLOR
Not set
NO_COLOR
Not set
Rich Console options
Name
Value
size
width=120, height=30
legacy_windows
False
min_width
1
max_width
120
is_terminal
True
encoding
utf-8
max_height
30
justify
None
overflow
None
no_wrap
False
highlight
None
markup
None
height
None
The text was updated successfully, but these errors were encountered:
This is expected. Rich can only capture output generated from its own process. To capture output from another process, you will need to use subprocesses. There is good support for subprocesses in the standard library.
Outputs from
os.system
orsubprocess.call
are not captured by textual, and appear at the top-left of the terminal instead.My goal is to run scripts upon button presses, and to see the scripts' outputs in a Log widget in realtime.
textual diagnose
didn't recognize my terminal. I am using Windows Terminal version 1.21.2911.0, but I have the same issue using the legacy terminal (by selecting "Windows Console Host" in Windows 11 settings). The issue is there using PowerShell 7.4.6 or MS-DOS for the terminal. Note thatos.system
runs MS-DOS.Here is a video, and the MRE can be found below.
textual.mp4
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: