1

To test something I have a very simple startup.py file in my .qgis/python folder:

import qgis
qgis.utils.iface.actionShowPythonDialog().trigger()

print "Welcome chump"

Python console launches fine, Welcome chump consistently prints out twice. Why is this?

  • Could you open an issue report for this with details about the affected QGIS version? The next release is around the corner and only fixed bugs are good bugs :) qgis.org/en/site/getinvolved/development/bugreporting.html – Matthias Kuhn Jun 29 '16 at 15:13
  • @MatthiasKuhn yes will do, I'll just have to wait until I'm back at the office to get full info on version number etc. It appears then that this is a genuine bug? – Alex Jun 29 '16 at 15:19
  • It does not sound like proper behavior to me and deserves being investigated – Matthias Kuhn Jun 29 '16 at 15:25
  • @MatthiasKuhn FYI: hub.qgis.org/issues/15189 – Alex Jul 1 '16 at 14:03
  • 1
    FYI: Fixed in QGIS 2.16 – Matthias Kuhn Jul 2 '16 at 15:18
2

I’m facing the same problem. I have not found a real solution, but I found out, that in content of the build in variable __name__ changes. It is “qgis.user” one time and “startup” the other. So you can work around the problem by:

import qgis
if __name__=="qgis.user":
    qgis.utils.iface.actionShowPythonDialog().trigger()
    print "Welcome chump"
1

It was a bug that was fixed - see https://issues.qgis.org/issues/15189

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.