Unsolved QFileSystemWatch -checking the possibility
-
i am running python script from my qt c++ application using QProces, that python script indeed runs separate executable which will create the files in specified folder.
i need to throw an error or success message once separate executable completed its run.
The problem is like, when i watch that specific folder using QFileSystemWatcher. the file is created initially(with 0 kb) and i get the signal from QFileSystemWatcher directory change. But i need to get the signal once all the data is wriiten into that file(>15Mb) completely.
Is there any work around i can use with QFileSystemWatcher to acheive this
-
Can you check the file size once your QProcess has completed? Or check the exit status of that executable once the QProcess has completed?
-
@meganathan
You don't say what your OS is, File system watching behaviour may vary across OSes. It's only promising to tell you when the file system changes (like creating a file), not necessarily when content/size changes. I don't think it does. You may get just one notification, at the beginning, not necessarily at the end.You may have to use OS-specific calls to get that, if the OS even supports it.
Otherwise as @mchinand said it would be a lot easier if you are running your own processes and can just wait for them to exit to look at file size,
-
@mchinand said in QFileSystemWatch -checking the possibility:
check the exit status of that executable once the QProcess has completed?
I am using Windows 10 .i need to get the notification once file content is fully written.
-
Rework your script that it returns once the file is completely written.
-
@mchinand from QProcess i just run the python script file. Inside the script file ANSYS process is called. If i can run directly from QProcess i could get the finished signal for the Qprocess but the requirement is to run it from python script that is the problem
-
But python runs until the script is finished, or?
You could also rename the output file once it is ready to the correct filename.
-
@meganathan If you must call it from a python script, call
exit(your_process_exit_code)
at the end of the script; passing along the exit code of your process.