Re: [QGIS-Developer] Bug with python macro on project load

2019-08-15 Thread Mario Baranzini
Bo's code works as expected, but even for me the traceback fails if there are errors. [image: image.png] On Wed, 14 Aug 2019 at 22:13, Tim Sutton wrote: > Thanks Bo! @Mario can you confirm which behaviour you replicated? The > exception when calling traceback.print_exception() failed > or my

Re: [QGIS-Developer] Bug with python macro on project load

2019-08-14 Thread Tim Sutton
Thanks Bo! @Mario can you confirm which behaviour you replicated? The exception when calling traceback.print_exception() failed or my dodgy code simply failing with a nice exception message as Bo demonstrated (which is expected behaviour). Regards Tim > On 14 Aug 2019, at 20:25, Bo Victor

Re: [QGIS-Developer] Bug with python macro on project load

2019-08-14 Thread Bo Victor Thomsen
Hi Tim !  (Greetings from Denmark :-) On Windows 8.1 64 bit and QGIS 3.8.1 64 bit: I've modified your python code a little bit: from qgis.core import QgsProject from qgis.utils import iface def openProject():     layers = QgsProject.instance().mapLayersByName('kommune')     layer = layers[0]  

Re: [QGIS-Developer] Bug with python macro on project load

2019-08-14 Thread Tim Sutton
Hi Oh thanks for the feedback! Regards Tim > On 14 Aug 2019, at 13:27, Mario Baranzini wrote: > > Hi Tim, > I have exactly the same error with QGIS 3.8.0 on Archlinux. > > Cheers > > On Wed, 14 Aug 2019 at 10:13, Tim Sutton > wrote: > Hi All > > I am running

Re: [QGIS-Developer] Bug with python macro on project load

2019-08-14 Thread Mario Baranzini
Hi Tim, I have exactly the same error with QGIS 3.8.0 on Archlinux. Cheers On Wed, 14 Aug 2019 at 10:13, Tim Sutton wrote: > Hi All > > I am running into a bug on macOS using QGIS 3.8 using the project load > python hook [1] and was curious: > > 1) Can anybody replicate this on other operating

[QGIS-Developer] Bug with python macro on project load

2019-08-14 Thread Tim Sutton
Hi All I am running into a bug on macOS using QGIS 3.8 using the project load python hook [1] and was curious: 1) Can anybody replicate this on other operating systems 2) Does the macro run *after* layers have been loaded in the project or before? Former seems more logical to me but you