[Interest] script invoked with QProcess cannot open files with spaces in path

Kyle Altendorf sda at fstab.net
Wed Aug 31 02:02:20 CEST 2016



On August 30, 2016 7:44:14 PM EDT, Kyle Altendorf <sda at fstab.net> wrote:
>
>
>On August 30, 2016 4:28:25 PM EDT, Larry Martell
><larry.martell at gmail.com> wrote:
>>I am invoking a python script with QProcess. I have found that if the
>>script tries to open a file that has spaces in the path, no error is
>>thrown, but the file always appears to have 0 length. The same script
>>with the same file with spaces in the path invoked from the command
>>line works fine. Note that this has nothing to do with argument
>>passing from the C++ code to the script via QProcess - the file path
>>name is hardcoded in the script. If the file has no spaces in its path
>>it is opened fine. I have tied escaping the spaces with \ but no joy.
>>Anyone know why this would be happening and know a way around this?
>
>Try printing sys.executable and os.getcwd() and see if they show any
>differences that might shed some light.  I'm on my phone so hopefully I
>am remembering those correctly.

Or, is the file being accessed or created by the calling C++ application?  Depending on how each opens it there could be a conflict of sorts there.




More information about the Interest mailing list