<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 29 Nov 2016 12:55 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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="quoted-text">On Mon, Nov 28, 2016 at 3:44 PM, Matthias Kuhn <span dir="ltr"><<a href="mailto:matthias@opengis.ch" target="_blank">matthias@opengis.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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></blockquote><div><br><br></div></div><div>Yes, it seems so:<br></div><div><br>>>> from PyQt5.QtWidgets import QApplication, QWidget<br>>>> a = QApplication([])<br>>>> a.argv()<div class="quoted-text"><br>Traceback (most recent call last):<br></div>  File "<stdin>", line 1, in <module><div class="quoted-text"><br>AttributeError: 'QApplication' object has no attribute 'argv'<br></div></div></div></div></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Shouldn't that be QApplication.arguments()?</div><div dir="auto"><br></div><div dir="auto"><a href="http://doc.qt.io/qt-5/qcoreapplication.html#arguments">http://doc.qt.io/qt-5/qcoreapplication.html#arguments</a><br></div><div dir="auto"><br></div><div dir="auto">There's no QApplication::argv member.</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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="quoted-text"><br><br></div>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></div><div>Now I wonder if this is a PyQt bug or something changed in Qt itself<br><br></div><div>Is there anything we can do to get the argv/argc in a python script running inside QGIS?<br><br></div><div>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></div><div>fortunately, there are some workarounds.<br></div><div class="elided-text"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Matthias<br>
<div><div class="m_5098690681987426854gmail-h5"><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().argv<wbr>()<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>
</div></div>> w3:   <a href="http://www.itopen.it" rel="noreferrer" target="_blank">www.itopen.it</a> <<a href="http://www.itopen.it" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-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" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman<wbr>/listinfo/qgis-developer</a></blockquote></div></div><div class="elided-text"><br><br clear="all"><br>-- <br><div class="m_5098690681987426854gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div></div>
<br>______________________________<wbr>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://lists.osgeo.org/<wbr>mailman/listinfo/qgis-<wbr>developer</a><br></blockquote></div><br></div></div></div>