Bug report #20907
Cannot "from qgis.core import *" from Python script
|Category:||Python bindings / sipify|
|Affected QGIS version:||3.4.3||Regression?:||No|
|Operating System:||Windows 10 Home Edition 64-bit||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||invalid|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||28726|
While attempting to create a custom Python script for QGIS v3.4.3 (Madeira), I encountered the following Python error after running this command:
from qgis.core import *
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from qgis.core import * File "C:\Program Files\QGIS 3.4\apps\qgis\python\qgis\__init__.py", line 80, in <module> import qgis.gui File "C:\Program Files\QGIS 3.4\apps\qgis\python\qgis\gui\__init__.py", line 27, in <module> from qgis._gui import * ValueError: PyCapsule_GetPointer called with incorrect name
Note: This particular trace was generated by IDLE (thus "<pyshell#0>" as the original file name).
Other instances of a similar error (involving `PyCapsule_GetPointer`) have been reported with PyQt in its own bug tracker.
Oddly enough, when this same command is run in the QGIS Python console, no errors are generated.
Also, this error came after the same import command was unable to find the PyQt5 module. This was resolved by `pip install`ing PyQt5, which I initially assumed that QGIS had already done.