QProcess can launch programs but not python (command line)
-
The following code is failing to launch the python command line.
QProcess *myProcess = new QProcess(this); myProcess->start("\"C:\\Program Files\\Python27\\python.exe\"");
If I replace python27 with (for example)
myProcess->start("\"C:\\Program Files\\Notepad++\\notepad++.exe\"")
notepad opens. Why is my program able to launch notepad but not Python Command Line?
I tried using startDetached() but that didn't make a difference.
QProcess::Error() gives me error 5: unknown error.
[edit koahnig: code tags added]
-
Hi,
What are you expecting when calling python like that ?
-
@SGaist is it wrong to expect the command line to actually open as a window? I've just noticed that I can open most applications except command lines. (When I try to launch cmd.exe, git-cmd.exe, python.exe nothing happens while I can open e.g. chrome.exe, git-bash.exe, notepad.exe)
-
@jonasqt said in QProcess can launch programs but not python (command line):
is it wrong to expect the command line to actually open as a window
Yes, it is. Command line tools do not have any windows - they run in a shell/terminal (terminal has a window). On Windows you can try pythonw.exe instead of python.exe. Or you start cmd.exe and pass the path to Python executable with -c as parameter to cmd.exe