PyQt5 bug report: Application fails to start when cwd contains non-ASCII characters

Jeremy Katz jkatz at volexity.com
Thu Aug 10 22:04:08 BST 2023


On 8/10/23 11:15, Jean Abou Samra wrote:

> 
> $ pushd non-äscii; sh ../reproduce.sh; popd
> ~/tmp/non-äscii ~/tmp
> Collecting PyQt5
>    Using cached PyQt5-5.15.9-cp37-abi3-manylinux_2_17_x86_64.whl (8.4 MB)
> Collecting PyQt5-sip<13,>=12.11
>    Using cached PyQt5_sip-12.12.2-cp311-cp311-
> manylinux_2_5_x86_64.manylinux1_x86_64.whl (346 kB)
> Collecting PyQt5-Qt5>=5.15.2
>    Using cached PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB)
> Installing collected packages: PyQt5-Qt5, PyQt5-sip, PyQt5
> Successfully installed PyQt5-5.15.9 PyQt5-Qt5-5.15.2 PyQt5-sip-12.12.2
> 
> [notice] A new release of pip available: 22.3.1 -> 23.2.1
> [notice] To update, run: pip install --upgrade pip
> Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland
> to run on Wayland anyway.
> qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
> This application failed to start because no Qt platform plugin could be
> initialized. Reinstalling the application may fix this problem.
> 
> ../reproduce.sh : ligne 4 : 114140 Abandon                 (core dumped)python -
> c "from PyQt5.QtWidgets import QApplication; app = QApplication([])"

It also occurs on macOS when Qt is installed in the directory in 
question. The current working directory doesn't matter. The plugin path 
and library path appear to be corrupted.

test.py:
import os
import PyQt5.QtCore as C
print(f"\nCWD: {os.getcwd()}")
print(f"plugin path: 
{C.QLibraryInfo.location(C.QLibraryInfo.LibraryLocation.PluginsPath)}")
print(f"library paths: {C.QCoreApplication.libraryPaths()}")

$ ./test.py
CWD: /private/tmp
plugin path: 
/private/tmp/non-äscii/venv/lib/python3.8/site-packages/PyQt5/Qt5/plugins
library paths: []


A C++ program directed to use the same installation via 
DYLD_FRAMEWORK_PATH works as expected.

test.cpp:
#include <QCoreApplication>
#include <QLibraryInfo>
#include <QDebug>
#include <sys/param.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
     char buffer[MAXPATHLEN];
     qDebug() << "CWD:" << getcwd(buffer, sizeof(buffer));
     qDebug() << "plugin path:" << 
QLibraryInfo::location(QLibraryInfo::LibraryLocation::PluginsPath);
     qDebug() << "library paths:" << QCoreApplication::libraryPaths();
     return 0;
}

$ export 
DYLD_FRAMEWORK_PATH=/tmp/non-äscii/venv/lib/python3.8/site-packages/PyQt5/Qt5/lib
$ ./build-path-Desktop_Qt_5_15_14_clang_64bit-Debug/path
CWD: /private/tmp
plugin path: 
"/private/tmp/non-äscii/venv/lib/python3.8/site-packages/PyQt5/Qt5/plugins"
library paths: 
("/private/tmp/non-äscii/venv/lib/python3.8/site-packages/PyQt5/Qt5/plugins")

Neither QT_DEBUG_PLUGINS=1 nor QT_LOGGING_RULES="*.*=true" had anything 
interesting to report.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x67F18D5A76753BBB.asc
Type: application/pgp-keys
Size: 3147 bytes
Desc: OpenPGP public key
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230810/73c2ac74/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230810/73c2ac74/attachment-0001.sig>


More information about the PyQt mailing list