<div dir="ltr"><div class="gmail_quote"><div dir="ltr">A friend of mine hit what looks like a bug in SIP, as outlined in this stackoverflow post:<div><br></div><div><a href="http://stackoverflow.com/questions/28402234/cannot-wrap-qwebview-load-method" target="_blank">http://stackoverflow.com/questions/28402234/cannot-wrap-qwebview-load-method</a></div><div><br></div><div>This appears to be a bug in SIP, which appears to be raising a TypeError when it shouldn't. It seems that the existence of **kwargs in the method call, even if kwargs is an empty dictionary, trips up some of SIPs error checking. The following snippet (also attached) demonstrates this:</div><div><br></div><div><table cellspacing="0" cellpadding="0" style="border:0px;margin:0px;padding:0px;border-collapse:collapse;empty-cells:show;color:rgb(0,0,0);font-family:monospace;font-size:14.6666669845581px;white-space:pre-wrap"><tbody><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 1 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">import</span><span style="display:inline-block;border:0px;margin:0px"> sys</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 2 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 3 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"></span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">from</span><span style="display:inline-block;border:0px;margin:0px"> PyQt4 </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">import</span><span style="display:inline-block;border:0px;margin:0px"> QtCore</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 4 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"></span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">from</span><span style="display:inline-block;border:0px;margin:0px"> PyQt4 </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">import</span><span style="display:inline-block;border:0px;margin:0px"> QtGui</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 5 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 6 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"></span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">from</span><span style="display:inline-block;border:0px;margin:0px"> PyQt4.QtWebKit </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">import</span><span style="display:inline-block;border:0px;margin:0px"> QWebView</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 7 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 8 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">qapplication </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">=</span><span style="display:inline-block;border:0px;margin:0px"> QtGui.</span><span style="display:inline-block;border:0px;margin:0px">QApplication</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px">sys.argv</span><span style="display:inline-block;border:0px;margin:0px">)</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 9 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 10 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">webview </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">=</span><span style="display:inline-block;border:0px;margin:0px"> </span><span style="display:inline-block;border:0px;margin:0px">QWebView</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px">)</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 11 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 12 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">url </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">=</span><span style="display:inline-block;border:0px;margin:0px"> QtCore.</span><span style="display:inline-block;border:0px;margin:0px">QUrl</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px;color:rgb(143,134,52)">'</span><span style="display:inline-block;border:0px;margin:0px;color:rgb(143,134,52)"><a href="http://istonyabbottstillprimeminister.com" target="_blank">http://istonyabbottstillprimeminister.com</a></span><span style="display:inline-block;border:0px;margin:0px;color:rgb(143,134,52)">'</span><span style="display:inline-block;border:0px;margin:0px">)</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 13 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 14 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">kwargs </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(199,0,64)">=</span><span style="display:inline-block;border:0px;margin:0px"> </span><span style="display:inline-block;border:0px;margin:0px">{</span><span style="display:inline-block;border:0px;margin:0px">}</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 15 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px"></span><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)">#</span><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)"> webview.load(url, **kwargs) # Doesn't work</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 16 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)"></span><span style="display:inline-block;border:0px;margin:0px">webview.</span><span style="display:inline-block;border:0px;margin:0px">load</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px">url</span><span style="display:inline-block;border:0px;margin:0px">)</span><span style="display:inline-block;border:0px;margin:0px"> </span><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)">#</span><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)"> works</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 17 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px;color:rgb(165,165,165)"> </span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 18 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">webview.</span><span style="display:inline-block;border:0px;margin:0px">show</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px">)</span>
</div></td></tr><tr><td valign="top" style="padding:0px 10px 0px 0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace;background:rgb(229,229,229)"><span style="display:inline-block;border:0px;margin:0px;color:rgb(133,133,133)"> 19 </span></td><td valign="top" style="padding:0px;font-stretch:normal;font-size:11pt;font-family:'Ubuntu Mono',Courier,monospace"><div style="width:455px"><span style="display:inline-block;border:0px;margin:0px">qapplication.</span><span style="display:inline-block;border:0px;margin:0px">exec_</span><span style="display:inline-block;border:0px;margin:0px">(</span><span style="display:inline-block;border:0px;margin:0px">)</span></div></td></tr></tbody></table><div><br></div><div>Uncomment line 15 and one gets the following:</div><div><br></div><div><div><font face="monospace, monospace" color="#ff0000">Traceback (most recent call last):</font></div><div><font face="monospace, monospace" color="#ff0000"> File "/home/bilbo/Documents/Scratch/demonstration.py", line 15, in <module></font></div><div><font face="monospace, monospace" color="#ff0000"> webview.load(url, **kwargs) # Doesn't work</font></div><div><font face="monospace, monospace" color="#ff0000">TypeError: QWebView.load(QUrl): argument 1 has unexpected type 'QUrl'</font></div></div><div><br></div><div>Even though since kwargs is an empty dictionary, lines 15 and 16 ought to be equivalent. I had a look at the SIP source and was unable to track down where the problem might be, though I'm guessing it's in<font face="monospace, monospace"> <a href="http://siplib.c.in" target="_blank">siplib.c.in</a></font> somewhere.</div><div><br>The problem exists in both Python 2.7 and 3.4, and both PyQt4 and PyQt5.</div><div><br></div><div>Regards,</div></div><div><br></div><div>Chris Billington</div></div></div></div>