Answer the question
In order to leave comments, you need to log in
How to enter a command in screen in python?
In general, the essence of the program is as follows:
screen -r name
).import subprocess
import keyboard
import asyncio
async def go_screen():
subprocess.check_call(['screen', '-r', 'name'])
async def lets_keyboard():
await asyncio.sleep(2.0)
keyboard.send('s')
keyboard.send("y")
keyboard.send("n")
keyboard.send("c")
keyboard.send("u")
keyboard.send("p")
keyboard.send("ctrl+a+d")
loop = asyncio.get_event_loop()
coros = [go_screen(), lets_keyboard()]
loop.run_until_complete(asyncio.gather(*coros))
Answer the question
In order to leave comments, you need to log in
Have you read the documentation at all? Or laziness?
subprocess.check_call(args, *, stdin=None, stdout=None, stderr=None, shell=False, cwd=None, timeout=None, **other_popen_kwargs)
Run command with arguments. Wait for command to complete . If the return code was zero then return,
Not an answer, but a correction in your code:
keyboard.send('s')
keyboard.send("y")
keyboard.send("n")
keyboard.send("c")
keyboard.send("u")
keyboard.send("p")
keyboard.write('syncup', delay=0.1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question