To launch cmd line terminal, keep it alive and keep sending commands to it from a Kivy GUI
up vote
0
down vote
favorite
Version: Python 3.7 | Platform: Windows 7
My goal: To launch cmd line terminal, keep it alive and keep sending commands to it from a Kivy GUI
My Issue: Subprocess terminates after command exectution
Description: I have a GUI with two buttons. Each button should send some commands to the teminal. After executing "button1" callback function, the spawned child process terminates. And then, when I try to run the "button2" callback, I get an error "ValueError: I/O operation on closed file".
Here is my code:
def button1_callback(self):
self.child = popen_spawn.PopenSpawn("cmd.exe")
self.child.sendline("dir")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
def button2_callback(self):
self.child.sendline("cd E:/temp")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
python python-3.x subprocess pexpect
add a comment |
up vote
0
down vote
favorite
Version: Python 3.7 | Platform: Windows 7
My goal: To launch cmd line terminal, keep it alive and keep sending commands to it from a Kivy GUI
My Issue: Subprocess terminates after command exectution
Description: I have a GUI with two buttons. Each button should send some commands to the teminal. After executing "button1" callback function, the spawned child process terminates. And then, when I try to run the "button2" callback, I get an error "ValueError: I/O operation on closed file".
Here is my code:
def button1_callback(self):
self.child = popen_spawn.PopenSpawn("cmd.exe")
self.child.sendline("dir")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
def button2_callback(self):
self.child.sendline("cd E:/temp")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
python python-3.x subprocess pexpect
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Version: Python 3.7 | Platform: Windows 7
My goal: To launch cmd line terminal, keep it alive and keep sending commands to it from a Kivy GUI
My Issue: Subprocess terminates after command exectution
Description: I have a GUI with two buttons. Each button should send some commands to the teminal. After executing "button1" callback function, the spawned child process terminates. And then, when I try to run the "button2" callback, I get an error "ValueError: I/O operation on closed file".
Here is my code:
def button1_callback(self):
self.child = popen_spawn.PopenSpawn("cmd.exe")
self.child.sendline("dir")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
def button2_callback(self):
self.child.sendline("cd E:/temp")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
python python-3.x subprocess pexpect
Version: Python 3.7 | Platform: Windows 7
My goal: To launch cmd line terminal, keep it alive and keep sending commands to it from a Kivy GUI
My Issue: Subprocess terminates after command exectution
Description: I have a GUI with two buttons. Each button should send some commands to the teminal. After executing "button1" callback function, the spawned child process terminates. And then, when I try to run the "button2" callback, I get an error "ValueError: I/O operation on closed file".
Here is my code:
def button1_callback(self):
self.child = popen_spawn.PopenSpawn("cmd.exe")
self.child.sendline("dir")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
def button2_callback(self):
self.child.sendline("cd E:/temp")
self.child.sendeof()
self.txt += 'nn' + self.child.read().decode()
self.update()
python python-3.x subprocess pexpect
python python-3.x subprocess pexpect
asked Nov 11 at 13:43
Akisame Koetsuji
11
11
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249342%2fto-launch-cmd-line-terminal-keep-it-alive-and-keep-sending-commands-to-it-from%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown