Item Not Found-error in QFileDialog.getSaveFileName()-call when space in path on Windows

43 Views Asked by At

I'm experiencing strange behaviour in a QFileDialog.getSaveFileName()-call. When the dialog has to deal with a path with a space in it, either when I try to create a new folder to save the file in or when trying to save a file (i.e. complete the call regularly), the dialog results in an Item or a File Not Found error message dialog.

System details:

  • PySide 6.5.2
  • Python 3.11
  • Windows 10 Pro

MRE:

import sys
from PySide6.QtCore import QStandardPaths
from PySide6.QtWidgets import QFileDialog, QMainWindow, QApplication

default_path = QStandardPaths.writableLocation(QStandardPaths.HomeLocation)
print(repr(default_path))  # 'C:/Users/O P'

app = QApplication(sys.argv)
window = QMainWindow()
window.show()

bundle_path, _ = QFileDialog.getSaveFileName(window, "Create New Bundle",
                                             default_path,
                                             "Bundle (*.deb)")
print(repr(bundle_path))

The code works as expected when trying to save to a path without space (e.g. 'C:/test.deb') or when executing on macOS.

0

There are 0 best solutions below