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?

5
  • 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 Commented Jun 29, 2016 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
    Commented Jun 29, 2016 at 15:19
  • It does not sound like proper behavior to me and deserves being investigated Commented Jun 29, 2016 at 15:25
  • @MatthiasKuhn FYI: hub.qgis.org/issues/15189
    – Alex
    Commented Jul 1, 2016 at 14:03
  • 1
    FYI: Fixed in QGIS 2.16 Commented Jul 2, 2016 at 15:18

2 Answers 2

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 and acknowledge you have read our privacy policy.

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