On 29 Nov 2016 7:36 AM, "Alessandro Pasotti" <[email protected]> wrote:
Il 28/nov/2016 20:32, "Nyall Dawson" <[email protected]> ha scritto: > > > > On 29 Nov 2016 12:55 AM, "Alessandro Pasotti" <[email protected]> wrote: >> >> On Mon, Nov 28, 2016 at 3:44 PM, Matthias Kuhn <[email protected]> wrote: >>> >>> Hi Alessandro, >>> >>> QApplication is part of PyQt, did you check if it also changed if you >>> run a non-QGIS pyqt application? >> >> >> >> Yes, it seems so: >> >> >>> from PyQt5.QtWidgets import QApplication, QWidget >> >>> a = QApplication([]) >> >>> a.argv() >> >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> >> AttributeError: 'QApplication' object has no attribute 'argv' > > > Shouldn't that be QApplication.arguments()? > > http://doc.qt.io/qt-5/qcoreapplication.html#arguments > > There's no QApplication::argv member. > > Nyall > Thanks, arguments() works the same as argv() for Qt5. 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? http://pyqt.sourceforge.net/Docs/PyQt4/qcoreapplication.html#argv 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. Nyall >> >> >> In [2]: import sys >> ...: from PyQt4 import Qt >> ...: >> ...: a = Qt.QApplication(sys.argv) >> ...: >> >> In [3]: a.argv() >> Out[3]: ['/usr/local/bin/ipython'] >> >> >> Now I wonder if this is a PyQt bug or something changed in Qt itself >> >> Is there anything we can do to get the argv/argc in a python script running inside QGIS? >> >> This is needed by the testing environment in https://github.com/ boundlessgeo/qgis-testing-environment-docker/blob/ master/qgis_testrunner.py#L150 >> fortunately, there are some workarounds. >> >> >>> >>> >>> Matthias >>> >>> On 11/28/2016 03:35 PM, Alessandro Pasotti wrote: >>> > Hi, >>> > >>> > the following code is working fine in 2.x but not in master: >>> > >>> >>>> QgsApplication.instance().argv() >>> > Traceback (most recent call last): >>> > File "/usr/lib/python3.5/code.py", line 91, in runcode >>> > exec(code, self.locals) >>> > File "<input>", line 1, in <module> >>> > AttributeError: 'QApplication' object has no attribute 'argv' >>> > >>> > >>> > I looked at the sip file but I did not find the reason why it's now >>> > failing, any idea what has changed in this regard? >>> > >>> > >>> > -- >>> > Alessandro Pasotti >>> > w3: www.itopen.it <http://www.itopen.it> >>> > >>> > >>> > _______________________________________________ >>> > Qgis-developer mailing list >>> > [email protected] >>> > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>> > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>> > >>> _______________________________________________ >>> Qgis-developer mailing list >>> [email protected] >>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer >> >> >> >> >> -- >> Alessandro Pasotti >> w3: www.itopen.it >> >> _______________________________________________ >> Qgis-developer mailing list >> [email protected] >> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer > >
_______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
