[PyQt] ValueError: PyCapsule_GetPointer called with incorrect name

Patrick Stinson patrickkidd at gmail.com
Fri Apr 24 08:17:43 BST 2020


Turns out there were two separate problems:

- That the installation dir for PyQt5 .sip files was in %PATH%, and python (at least 3.6.4) on windows will import a folder as a namespace even if it doesn’t have a __init__.py. Moving the folder fixed that problem.

- I hadn’t added “-n PyQt5.sip” to the PyQt5 configure line, which meant that the module init function for my sip extension was unable to import the “_C_API” object from the sip module for use in the capsule call, which the fails silently.

-Patrick

> On Apr 23, 2020, at 10:10 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
> 
> When I import my sip extension module (named “_pkdiagram”) on windows I get the following error:
> 
> 
> C:\Users\patrick\Desktop\familydiagram\_pkdiagram>python -c "import _pkdiagram"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> SystemError: initialization of _pkdiagram failed without raising an exception
> 
> 
> Turns out the mod init function fails without setting an exception when it can’t find "_C_API" on the sip module - the call returns null.
> 
> sip_capiobj = PyDict_GetItemString(PyModule_GetDict(sip_sipmod), "_C_API");
> 
> Any ideas?
> 
> Thanks!
> -Patrick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200423/3b2452a3/attachment.htm>


More information about the PyQt mailing list