<div dir="ltr">Hey Chris,<div><br></div><div style>Yes I forgot to mention that any standalone pyqgis scripts, like the unit tests, will need to have the sip version set before PyQt4 is imported.  On Python < 3 PyQt4 will automatically set its SIP version to 1.  In Python > 3 this will change but for now you will have to set it your self. </div>

<div style><br></div><div style>What I did think of doing was setting the SIP version in qgis.core so that if you import them first then everything is set for you.  What are your thoughts on doing this?</div><div style><br>

</div><div style>- Nathan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 19, 2013 at 5:59 AM, Chris Crook <span dir="ltr"><<a href="mailto:ccrook@linz.govt.nz" target="_blank">ccrook@linz.govt.nz</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok I've found it at<br>
<br>
<a href="http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2" target="_blank">http://stackoverflow.com/questions/6238193/pyqt-new-api-with-python-2</a><br>
<br>
Looks like I need to add<br>
<br>
import sip<br>
API_NAMES = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]<br>
API_VERSION = 2<br>
for name in API_NAMES:<br>
    sip.setapi(name, API_VERSION)<br>
<br>
before importing from PyQt4.QtCore.  And also to not try and import QString.<br>
<br>
Seems to be working..<br>
<span class="HOEnZb"><font color="#888888"><br>
Chris<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> -----Original Message-----<br>
> From: Chris Crook<br>
> Sent: Wednesday, 19 June 2013 6:15 a.m.<br>
> To: <a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a><br>
> Subject: [Qgis-developer] Python unit tests and SIP API version<br>
><br>
> Hi<br>
><br>
> Currently when I run make the unit tests (unbuntu) the delimited text<br>
> python tests are running under SIP API version 1, or possibly some sort of<br>
> strange mixture, and seem to be failing.  So if I do<br>
><br>
> from PyQt4.QtCore import QVariant<br>
> import sip<br>
><br>
> print sip.getapi('QVariant')<br>
><br>
> I get '1'.  I see sip as a setapi function, which I guess I should be using to set<br>
> the API I want.  Anyone know how to use it?<br>
><br>
> Thanks<br>
> Chris<br>
><br>
> This message contains information, which is confidential and may be<br>
> subject to legal privilege. If you are not the intended recipient, you must<br>
> not peruse, use, disseminate, distribute or copy this message. If you have<br>
> received this message in error, please notify us immediately (Phone 0800<br>
> 665 463 or <a href="mailto:info@linz.govt.nz">info@linz.govt.nz</a>) and destroy the original message. LINZ accepts<br>
> no responsibility for changes to this email, or for any attachments, after its<br>
> transmission from LINZ. Thank You.<br>
<br>
<br>
This message contains information, which is confidential and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or <a href="mailto:info@linz.govt.nz">info@linz.govt.nz</a>) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.<br>


_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></div></blockquote></div><br></div>