Reputation: 349
In python, is it possible to run a shell command, while the command stored in variable as text ? for example:
self.command_editor = QTextEditor()
self.command_editor.append("echo command")
cmd = str(self.command_editor.toPlainText())
call(cmd)
this code doesn`t work!
Upvotes: 0
Views: 42
Reputation: 349
this is the right answer:
self.command_editor = QTextEditor()
self.command_editor.append("echo command")
cmd = str(self.command_editor.toPlainText())
call(cmd, shell = True) #the mistake was here
Upvotes: 1