abbaasi69
25th July 2020, 23:18
Stackoverflow question (https://stackoverflow.com/questions/63089848/command-run-in-terminal-but-not-in-qprocess-while-paths-are-inserted)
I want to run a command in Ubuntu via Qt using QProcess. My command is fluent3DMeshToFoam <mesh address> and when I run it into terminal its OK and produces sum output and files in a specific location. But I have problem with running it using QProcess.
I have noticed that I should add the path of fluent3DMeshToFoam to ProcessEnvironment of my QProcess object. So I did:
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("PATH" , env.value("PATH") + ":"+"<path of fluent3DMeshToFoam>");
myProcess.setProcessEnvironment(env);
myProcess.start("fluent3DMeshToFoam" , QStringList() << "<mesh address>");
myProcess.waitForFinished(-1);
I connected readyRead()and errorOccurred() signals and after I run, the errorOccurred signal emits and the following error shows:
execve: No such file or directory
I searched alot and could not find out where the problem is. thanks.
I want to run a command in Ubuntu via Qt using QProcess. My command is fluent3DMeshToFoam <mesh address> and when I run it into terminal its OK and produces sum output and files in a specific location. But I have problem with running it using QProcess.
I have noticed that I should add the path of fluent3DMeshToFoam to ProcessEnvironment of my QProcess object. So I did:
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("PATH" , env.value("PATH") + ":"+"<path of fluent3DMeshToFoam>");
myProcess.setProcessEnvironment(env);
myProcess.start("fluent3DMeshToFoam" , QStringList() << "<mesh address>");
myProcess.waitForFinished(-1);
I connected readyRead()and errorOccurred() signals and after I run, the errorOccurred signal emits and the following error shows:
execve: No such file or directory
I searched alot and could not find out where the problem is. thanks.