Mastodon Feed: Post

Mastodon Feed

Boosted by glyph ("Glyph"):
david@theblower.au ("David de Groot") wrote:

Did you know that PySide6.QtWidgets.QFileDialog.getExistingDirectory()
behaves differently on Windows to macOS ? i.e. the returned path on macOS (and presumably Linux) has a trailing slash, whereas on Windows it does not.

Ordinarily not a huge deal, except when you use os.path.dirname combined with os.path.basename to get the final part of the path, which works swimmingly on macOS, but the lack of trailing slash means it breaks on Windows.

An easy fix, but something that caught me off guard.

#python #QT6