Since using the new installer for the x64 only version OSGeo4W/QGIS (new 3.22 LTR), I can't no longer use PyScripter with the bundled PyQt5. When I try to import QSettings for example, PyScripter can't find the needed DLL for QtCore (Qt5Core.dll in apps\qt5). When I do the same on the OSGeo4W shell, python imports without any problems. I use similar batch files to start python and PyScripter based on the bin\python-qgis-ltr.bat file:
@echo off
call "%~dp0\bin\o4w_env.bat"
@echo off
path %OSGEO4W_ROOT%\apps\qgis-ltr\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis-ltr
set GDAL_FILENAME_IS_UTF8=YES
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE
set VSI_CACHE_SIZE=1000000
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis-ltr\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins
set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis-ltr\python;%PYTHONPATH%
pause
cd %~dp0\PyScripter
start "PyScripter" /B "PyScripter.exe" --PYTHON39 --PYTHONDLLPATH=%OSGEO4W_ROOT%\apps\Python39
my test.py:
from PyQt5.QtCore import QSettings
As I said, Python successfully imports QSettings while PyScripter does give me this error:
>>> from PyQt5.QtCore import QSettings
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: DLL load failed while importing QtCore: Das angegebene Modul wurde nicht gefunden.
So, I don't know what I am missing, it used to work for QGIS <= 3.16.
PATH=C:\OSGeo4W\apps\qgis-ltr\bin;C:\OSGeo4W\apps\qt5\bin;C:\OSGeo4W\apps\Python39\Scripts;C:\OSGeo4W\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem
and it is set incall "%~dp0\bin\o4w_env.bat"
pluspath %OSGEO4W_ROOT%\apps\qgis-ltr\bin;%PATH%
. This works for python.exe but not for PyScripter.from qgis.PyQt.QtCore import QSettings
works. So I have at least a workaround.