<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 29 Nov 2016 7:36 AM, "Alessandro Pasotti" <<a href="mailto:apasotti@gmail.com">apasotti@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><p dir="ltr">Il 28/nov/2016 20:32, "Nyall Dawson" <<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>> ha scritto:<br>
><br>
><br>
><br>
> On 29 Nov 2016 12:55 AM, "Alessandro Pasotti" <<a href="mailto:apasotti@gmail.com" target="_blank">apasotti@gmail.com</a>> wrote:<br>
>><br>
>> On Mon, Nov 28, 2016 at 3:44 PM, Matthias Kuhn <<a href="mailto:matthias@opengis.ch" target="_blank">matthias@opengis.ch</a>> wrote:<br>
>>><br>
>>> Hi Alessandro,<br>
>>><br>
>>> QApplication is part of PyQt, did you check if it also changed if you<br>
>>> run a non-QGIS pyqt application?<br>
>><br>
>><br>
>><br>
>> Yes, it seems so:<br>
>><br>
>> >>> from PyQt5.QtWidgets import QApplication, QWidget<br>
>> >>> a = QApplication([])<br>
>> >>> a.argv()<br>
>><br>
>> Traceback (most recent call last):<br>
>>   File "<stdin>", line 1, in <module><br>
>><br>
>> AttributeError: 'QApplication' object has no attribute 'argv'<br>
><br>
><br>
> Shouldn't that be QApplication.arguments()?<br>
><br>
> <a href="http://doc.qt.io/qt-5/qcoreapplication.html#arguments" target="_blank">http://doc.qt.io/qt-5/<wbr>qcoreapplication.html#<wbr>arguments</a><br>
><br>
> There's no QApplication::argv member.<br>
><br>
> Nyall<br>
></p>
</div><p dir="ltr">Thanks, arguments() works the same as argv() for Qt5.</p>
<p dir="ltr">Do you by chance know where does argv member come from in PyQt4? I couldn't find it in the Qt 4.8 docs, that's why I was confused. Was it a PyQt addition? <a href="http://pyqt.sourceforge.net/Docs/PyQt4/qcoreapplication.html#argv" target="_blank">http://pyqt.sourceforge.net/<wbr>Docs/PyQt4/qcoreapplication.<wbr>html#argv</a></p></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I'm not sure either - it had me confused too. Maybe it was a qt3 thing that pyqt4 was aliasing to arguments(). But there's no mention of a related change in the PyQt5 changes.</div><div dir="auto"><br></div><div dir="auto">Nyall</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"><br></p><div class="elided-text">
<p dir="ltr">>><br>
>><br>
>> In [2]: import sys<br>
>>    ...: from PyQt4 import Qt<br>
>>    ...:  <br>
>>    ...: a = Qt.QApplication(sys.argv)<br>
>>    ...: <br>
>><br>
>> In [3]: a.argv()<br>
>> Out[3]: ['/usr/local/bin/ipython']<br>
>><br>
>><br>
>> Now I wonder if this is a PyQt bug or something changed in Qt itself<br>
>><br>
>> Is there anything we can do to get the argv/argc in a python script running inside QGIS?<br>
>><br>
>> This is needed by the testing environment in <a href="https://github.com/boundlessgeo/qgis-testing-environment-docker/blob/master/qgis_testrunner.py#L150" target="_blank">https://github.com/<wbr>boundlessgeo/qgis-testing-<wbr>environment-docker/blob/<wbr>master/qgis_testrunner.py#L150</a><br>
>> fortunately, there are some workarounds.<br>
>><br>
>>  <br>
>>><br>
>>><br>
>>> Matthias<br>
>>><br>
>>> On 11/28/2016 03:35 PM, Alessandro Pasotti wrote:<br>
>>> > Hi,<br>
>>> ><br>
>>> > the following code is working fine in 2.x but not in master:<br>
>>> ><br>
>>> >>>> QgsApplication.instance().<wbr>argv()<br>
>>> > Traceback (most recent call last):<br>
>>> >   File "/usr/lib/python3.5/code.py", line 91, in runcode<br>
>>> >     exec(code, self.locals)<br>
>>> >   File "<input>", line 1, in <module><br>
>>> > AttributeError: 'QApplication' object has no attribute 'argv'<br>
>>> ><br>
>>> ><br>
>>> > I looked at the sip file but I did not find the reason why it's now<br>
>>> > failing, any idea what has changed in this regard?<br>
>>> ><br>
>>> ><br>
>>> > --<br>
>>> > Alessandro Pasotti<br>
>>> > w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a> <<a href="http://www.itopen.it" target="_blank">http://www.itopen.it</a>><br>
>>> ><br>
>>> ><br>
>>> > ______________________________<wbr>_________________<br>
>>> > Qgis-developer mailing list<br>
>>> > <a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
>>> > List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>>> > Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>>> ><br>
>>> ______________________________<wbr>_________________<br>
>>> Qgis-developer mailing list<br>
>>> <a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
>>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>><br>
>><br>
>><br>
>><br>
>> -- <br>
>> Alessandro Pasotti<br>
>> w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> Qgis-developer mailing list<br>
>> <a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br>
><br>
></p>
</div></blockquote></div><br></div></div></div>