qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux
-
Now I have another problem, I can't get QProcess to work, it fails always with unknown error. The program I'm writing should do at the moment to call FFMPEG (ffprobe) to get the duration of the video I've selected in the gui, here the debug output. The commands for both videos are working fine when I copy them into a Linux terminal. Here the debug output:
/home/hk/Videos/gay-thai.mp4 /usr/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "/home/hk/Videos/gay-thai.mp4" Unbekannter Fehler Hallo 0 /home/hk/Videos/Moderne Frauen sind überteuert liefern zu wenig und Männer haben.mp4 /usr/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "/home/hk/Videos/Moderne Frauen sind überteuert liefern zu wenig und Männer haben.mp4" Unbekannter Fehler Hallo 0As suggested in the net, I've set the working directory in QT: QDir::setCurrent(QDir::rootPath());
@HansKottmann
May depend on how you useQProcessand where you get the error message from. -
Here my code, I would be happy to learn from you
Declaration of QProcess in the header file:
QProcess *procTime = new QProcess(this)Code in the *.cpp file
QString cmd = "/usr/bin/ffprobe"; QStringList args; args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\""); connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData())); procTime->start(cmd, args); sendDebug(procTime->program() + " " + procTime->arguments().join(" ")); sendDebug(procTime->errorString()); procTime->waitForStarted();sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io -
Here my code, I would be happy to learn from you
Declaration of QProcess in the header file:
QProcess *procTime = new QProcess(this)Code in the *.cpp file
QString cmd = "/usr/bin/ffprobe"; QStringList args; args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\""); connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData())); procTime->start(cmd, args); sendDebug(procTime->program() + " " + procTime->arguments().join(" ")); sendDebug(procTime->errorString()); procTime->waitForStarted();sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io@HansKottmann said in qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux:
procTime->start(cmd, args); sendDebug(procTime->program() + " " + procTime->arguments().join(" ")); sendDebug(procTime->errorString()); procTime->waitForStarted();You are printing
errorString()afterstart()but before evenwaitForStarted(). I would suggest yourUnbekannter Fehleris because there is no error at this point. You have not shown any error occurs.I do not know about your argument quoting. Is
-v errorreally supposed to be a single argument, it isn't if you pasted it on a command line? You are quoting the filepath? I am not sure all this quoting is correct/desired as arguments directly toffprobe, you might need tosh -c "..."it if you are not sure. But this comes after you sort out your error tester/printing. -
Here my code, I would be happy to learn from you
Declaration of QProcess in the header file:
QProcess *procTime = new QProcess(this)Code in the *.cpp file
QString cmd = "/usr/bin/ffprobe"; QStringList args; args << "-v error" << "-show_entries" << "format=duration" << "-of default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\""); connect(procTime, SIGNAL(readyRead()), this, SLOT(collectTimeData())); procTime->start(cmd, args); sendDebug(procTime->program() + " " + procTime->arguments().join(" ")); sendDebug(procTime->errorString()); procTime->waitForStarted();sendDebug() is the function that sends the debug messages to a QTextEdit window as I was not able to get QDebug to work.
My platform is Manjaro Linux, QtCreator was installed with the installer from qt.io@HansKottmann To add to @JonB you should connect a slot to https://doc.qt.io/qt-6/qprocess.html#errorOccurred and print the error there.
-
@HansKottmann
As @jsulm has written. And/or, bothwaitForStarted()andwaitForFinished()return abool, only if they returnfalsecan you then get a meaningfulerror()/errorString()(can do that without signal/slot).As I wrote before, I am dubious about your argument passing. I would expect you to use/need something more like:
args << "-v" << "error" << "-show_entries" << "format=duration" << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed();based on what you say works from the command line.
-
I've changed the args stringlist as you proposed and I still get Unknown Error. I assume as qDebug is not working too, that QT isn't working with Manjaro. It's a mess as I relayed for year in QT, but it got obviously useless.
-
I switched to openSuSE tumbleweed. QDebug works but the unknown error remains
-
The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:
args << "-v" << "error" << "-show_entries" << "format=duration" << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");The problem with QCommand is not yet solve, I will try first very simple commands first without args, then with one, then two... I think this is the only way to debug this.
-
The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:
args << "-v" << "error" << "-show_entries" << "format=duration" << "-of" << "default=noprint_wrappers=1:nokey=1" << inputFileName.trimmed().prepend("\"").append("\"");The problem with QCommand is not yet solve, I will try first very simple commands first without args, then with one, then two... I think this is the only way to debug this.
@HansKottmann said in qDebug() is not working anymore in QT-Creator (Installed from QT-Installer from QT.io, OS: Manjaro Linux:
The only thing I've changed is the args QStringList, it looks now exactly like yours, the only difference are the quotation marks at the beginning and the end of the file path string because filenames can have white spaces:
I already explained earlier that you are calling
errorString()too early. So did @jsulm . And what to do about it. YourUnknown Errorcurrently does not indicate anything has gone wrong. You need to change your code.Your understanding of whitespace as it appears when you type a command into a shell versus how to pass arguments to spawned processes is not right. The arglist should be as a wrote and not have quotes. Or send the whole command line to
bash -c.