problem with System()
-
You call it with a path relative to where you main application is started.
./home/princi
is equivalent to$PWD/home/princi/
which is likely not what you want, is it ?wrote on 24 Jun 2016, 07:58 last edited by@SGaist Now I do this and nothing as well..
QString program = "princi"; QStringList arguments; arguments << "0" << QString::number(wps.front().x()) << QString::number(wps.front().y()) << "0" << QString::number(wps.back().x()) << QString::number(wps.back().y()) << "prueba_princi.bmp" << "0 0 +" ; QString folder = "/home/"; QProcess *myProcess = new QProcess(this); myProcess->setWorkingDirectory(folder); myProcess->start(program,arguments);
-
What is the full path to
princi
? And what is the full path to your application ? -
/home is not the full path to your application except it is called home and is located in the root directory.
So, you can start the program in a shell with /home/princi?
Did you try it?
This is quite strange path: in /home you usually have a directory for each user and /home is not writable by normal user. -
/home is not the full path to your application except it is called home and is located in the root directory.
So, you can start the program in a shell with /home/princi?
Did you try it?
This is quite strange path: in /home you usually have a directory for each user and /home is not writable by normal user. -
-
-
@AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?
-
Ok, you must debug then
try to use
http://doc.qt.io/qt-5/qprocess.html#error
to see what it thinks. -
@AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?
-
@jsulm In a terminal if I write
./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
in /home/user1/ directory it runs good
-
Ok, you must debug then
try to use
http://doc.qt.io/qt-5/qprocess.html#error
to see what it thinks.wrote on 24 Jun 2016, 08:38 last edited byThis post is deleted! -
@jsulm In a terminal if I write
./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
in /home/user1/ directory it runs good
wrote on 24 Jun 2016, 08:39 last edited by AlvaroS -
well you can use
qDebug() "qproc: " << myProcess->error();and check the code in
http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum -
well you can use
qDebug() "qproc: " << myProcess->error();and check the code in
http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum -
" This is the default return value of error()."
You do call it AFTER u call
myProcess->start(program,arguments); ? -
" This is the default return value of error()."
You do call it AFTER u call
myProcess->start(program,arguments); ? -
@mrjj Yes:
myProcess->start(program, arguments); QProcess::ProcessError error = myProcess->error();
@AlvaroS
hmm really odd then
it should say FailedToStartJust to be 100% clear.
princi is never run ?
-
@AlvaroS
hmm really odd then
it should say FailedToStartJust to be 100% clear.
princi is never run ?
wrote on 24 Jun 2016, 08:48 last edited by@mrjj said:
@AlvaroS
hmm really odd then
it should say FailedToStartJust to be 100% clear.
princi is never run ?
okey look.
if I write:myProcess->start(program, arguments); myProcess->waitForFinished(3000); QProcess::ProcessError error = myProcess->error();
Now error says:
QProcess::Crashed The process crashed some time after starting successfully. -
so it sounds like your princi do run but it crashes?
oh. sorry my bad. start is async so calling error right after was
not correct.waitForFinished fixed that.
20/37