<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Turns out there were two separate problems:<div class=""><br class=""></div><div class="">- 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.</div><div class=""><br class=""></div><div class="">- 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.</div><div class=""><br class=""></div><div class="">-Patrick<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 23, 2020, at 10:10 PM, Patrick Stinson <<a href="mailto:patrickkidd@gmail.com" class="">patrickkidd@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">When I import my sip extension module (named “_pkdiagram”) on windows I get the following error:</div><div class=""><br class=""></div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">C:\Users\patrick\Desktop\familydiagram\_pkdiagram>python -c "import _pkdiagram"</div></div><div class=""><div class="">Traceback (most recent call last):</div></div><div class=""><div class=""> File "<string>", line 1, in <module></div></div><div class=""><div class="">SystemError: initialization of _pkdiagram failed without raising an exception</div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">sip_capiobj = PyDict_GetItemString(PyModule_GetDict(sip_sipmod), "_C_API");</div></blockquote><div class=""><br class=""></div><div class="">Any ideas?</div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">-Patrick</div></div></div></blockquote></div><br class=""></div></body></html>