Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1488

QDesktopServices.openUrl() fails for file with spaces in name with Gio error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      Arch Linux, Cinnamon

      Description

      Hi,

      Some application I use had some problems opening a file with spaces in its name. As far as I understand, it looks like a bad escape of the space between the Qt side and gnome's gio tool.

      I've put together minimal reproducible example:

      from PyQt5.QtGui import QGuiApplication, QDesktopServices
      from PyQt5.QtCore import QUrl, QTimer
      import sys
      
      def open_file():
          QDesktopServices.openUrl(QUrl('file name.txt'))
          app.exit()
      
      app = QGuiApplication(sys.argv)
      QTimer.singleShot(0, open_file)
      app.exec_()
      

      Results in:

      gio: file:///home/gkatev/Desktop/file%2520name.txt: Error when getting information for file "/home/gkatev/Desktop/file%20name.txt": No such file or directory
      

      This also results in the same gio error:

      $ gio open 'file%20name.txt'
      gio: file:///home/gkatev/Desktop/file%2520name.txt: Error when getting information for file "/home/gkatev/Desktop/file%20name.txt": No such file or directory
      

      This works correctly:

      gio open 'file name.txt'
      

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            crmaurei Cristian Maureira-Fredes
            Reporter:
            gkatev George K
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes