<div dir="ltr"><div><div>Phil,<br><br></div>That was the problem:<br><br>$ python<br>...<br>>>> from PyQt5 import QtCore<br>>>> from PyQt5 import QtDBus<br>>>> from PyKF5 import KDBusAddons<br>>>> help(KDBusAddons)<br></div>...etc...<br><div><div>>>> <br><br></div><div>As you suggested, I did some debugging, and the code seems to get right to the bottom of sipKDBusAddonscmodule.cpp, such that some printf-debug like this :<br><br> outfile << "at line " << __LINE__ << "\n" <<<br> " QtCore: " << sipModuleAPI_KDBusAddons_QtCore <<<br> " QtDbus: " << sipModuleAPI_KDBusAddons_QtDBus <<<br> " sipModule: " << sipModule << "\n";<br> SIP_MODULE_RETURN(sipModule);<br>}<br><br></div><div>emits *some* values:<br><br> QtCore: 0x7f0027642c20 QtDbus: 0x7f0027197540 sipModule: 0x7f00307c6e88<br><br></div><div>even in the error case. Is there some way to make the user experience more robust in this regard? (I'm going to poke around the PyImport_xxx APIs, but I assume there is a reason behind what is done at present?).<br><br></div><div>Thanks, Shaheed<br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 April 2016 at 15:48, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 20 Apr 2016, at 8:27 pm, Shaheed Haque <<a href="mailto:srhaque@theiet.org">srhaque@theiet.org</a>> wrote:<br>
><br>
> OK, after a bit of poking around, I realised I had not followed the<br>
> advice to add the library being bound to the makefile.extralibs. With<br>
> that in place, the error changes as follows, here with the linker<br>
> command line<br>
> for reference:<br>
><br>
> g++ -Wl,-Bsymbolic-functions -Wl,-z,relro -shared<br>
> -Wl,--version-script=KDBusAddons.exp -o KDBusAddons.so<br>
> sipKDBusAddonscmodule.o sipKDBusAddonsKDEInitInterface.o<br>
> sipKDBusAddonsKDEDModule.o sipKDBusAddonsKDBusService.o<br>
> sipKDBusAddonsKDBusInterProcessLock.o<br>
> sipKDBusAddonsKDBusConnectionPool.o -lKF5DBusAddons<br>
><br>
> And the actual Python error:<br>
><br>
> $ PYTHONPATH=cxx/KDBusAddons python<br>
> Python 2.7.10 (default, Oct 14 2015, 16:09:02)<br>
> [GCC 5.2.1 20151010] on linux2<br>
> Type "help", "copyright", "credits" or "license" for more information.<br>
>>>> import KDBusAddons<br>
> Traceback (most recent call last):<br>
> File "<stdin>", line 1, in <module><br>
> SystemError: dynamic module not initialized properly<br>
><br>
> Using Google, I found several references to this message, but none<br>
> seemed relevant [1]. Any suggestions on how to debug this? Or thoughts<br>
> on what might be missing?<br>
<br>
</span>I assume that KDBusAddons imports other KDE modules - if so what happens when you explicitly import those first?<br>
<br>
That exception will be raised when the import fails but no exception is raised to say why. You can look though the code of the SIP_MODULE_ENTRY() function and see exactly which call to SIP_MODULE_RETURN() is being made to get a better idea of where the problem is.<br>
<span class="HOEnZb"><font color="#888888"><br>
Phil</font></span></blockquote></div><br></div>