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

QUrl.path contains leading / on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.6.0
    • PySide
    • None
    • Windows

    Description

      For QUrl when you use the path() function to get the path. The path starts with a / which is correct on *Nix system. However it is not on Windows. This can be verify by the code below:

       import pathlib
      path = pathlib.Path('/C:')
      print(f'Path:

      {path} Exists: {path.exists()}')
      path = pathlib.Path('C:')
      print(f'Path: {path}

      Exists:

      {path.exists()}

      ')

      The first print statment prints that the path does not exists whilst the second prints that it does.
      Therefore, on windows you will have to remove the leading `/` in the path return by QUrl.path.

      I have attached a code example that makes a valid path using QUrl and QFileDialog.

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              loooptoolscim Lars Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes