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 <[email protected]> wrote: > 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 Thomsen <[email protected]> > wrote: > > 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] > iface.showAttributeTable(layer) > > > def saveProject(): > pass > > def closeProject(): > pass > > It works after enabling macro's. (You'll have to change the layer name > back to your original layer name) > > -- > Med venlig hilsen / Kind regards > > Bo Victor Thomsen > > > > Den 14-08-2019 kl. 17:21 skrev Tim Sutton: > > Hi > > Oh thanks for the feedback! > > Regards > > Tim > > On 14 Aug 2019, at 13:27, Mario Baranzini <[email protected]> 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 <[email protected]> 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 systems >> 2) Does the macro run *after* layers have been loaded in the project or >> before? Former seems more logical to me but you should never assume to >> much eh? :-) >> >> Thanks >> >> Tim >> >> >> >> [1] https://github.com/qgis/QGIS/issues/31235 >> — >> >> >> <KartozaNewLogoThumbnail.jpg> >> >> >> >> >> >> >> *Tim Sutton* >> >> *Co-founder:* Kartoza >> *Ex Project chair:* QGIS.org <http://qgis.org/> >> >> Visit http://kartoza.com to find out about open source: >> >> Desktop GIS programming services >> Geospatial web development >> GIS Training >> Consulting Services >> >> *Skype*: timlinux >> *IRC:* timlinux on #qgis at freenode.net >> >> I'd love to connect. Here's my calendar link >> <https://calendly.com/timlinux> to make finding time easy. >> >> _______________________________________________ >> QGIS-Developer mailing list >> [email protected] >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > > -- > Mario Baranzini > [email protected] > +41 (0)78 733 01 59 <+41787330159> > [image: http://www.opengis.ch] <http://www.opengis.ch/> > > > — > > > <KartozaNewLogoThumbnail.jpg> > > > > > > > *Tim Sutton* > > *Co-founder:* Kartoza > *Ex Project chair:* QGIS.org <http://qgis.org/> > > Visit http://kartoza.com to find out about open source: > > Desktop GIS programming services > Geospatial web development > GIS Training > Consulting Services > > *Skype*: timlinux > *IRC:* timlinux on #qgis at freenode.net > > I'd love to connect. Here's my calendar link > <https://calendly.com/timlinux> to make finding time easy. > > > _______________________________________________ > QGIS-Developer mailing [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > _______________________________________________ > QGIS-Developer mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > > > — > > > > > > > > > *Tim Sutton* > > *Co-founder:* Kartoza > *Ex Project chair:* QGIS.org > > Visit http://kartoza.com to find out about open source: > > Desktop GIS programming services > Geospatial web development > GIS Training > Consulting Services > > *Skype*: timlinux > *IRC:* timlinux on #qgis at freenode.net > > I'd love to connect. Here's my calendar link > <https://calendly.com/timlinux> to make finding time easy. > > _______________________________________________ > QGIS-Developer mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer -- Mario Baranzini [email protected] +41 (0)78 733 01 59 <+41787330159> [image: http://www.opengis.ch] <http://www.opengis.ch>
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
