Hi Nyall, This problem only happens in Windows. In Linux, everything is running fine.
I was convinced that it was a Python exception, but for some reason, it was not caught. I will investigate this issue further. It makes me crazy! Thank you for the feedback, Jorge Às 00:05 de 14/06/19, Nyall Dawson escreveu: > On Fri, 14 Jun 2019 at 00:11, Jorge Gustavo Pereira Bastos Rocha > <[email protected]> wrote: >> >> Hi devs, >> >> Am I able to catch Python exceptions in Python console? > > Yes, definitely > >> >> I'm trying to debug a DB Manager related issue [1] using pg_services. I have >> the following piece of code, that runs fine in my computer, but fails on any >> other computer, within a specific intranet. >> >> import psycopg2 >> print (psycopg2.__version__) >> try: >> connection = psycopg2.connect(service='pg_trabalho') >> cursor = connection.cursor() >> print ( connection.get_dsn_parameters(),"\n") >> cursor.execute("SELECT version();") >> record = cursor.fetchone() >> print("Connected to - ", record,"\n") >> except: >> print( psycopg2.InterfaceError ) >> print( psycopg2.OperationalError ) >> >> When I run it, QGIS crashes [2]. I would prefer to handle the exception >> myself. How can I catch the exception without crashing QGIS? > > This crash isn't caused by a Python exception -- it's something > deeper. If it was just a Python exception you'd see exactly the same > results as something like > > a = [1] > print(a[2]) > > Unfortunately, these kinds of crashes can be extremely difficult to > diagnose (especially if they are only reproducible on Windows). If you > can reproduce on Linux, I'd suggest running under valgrind and looking > for clues. > > Nyall > J. Gustavo -- Jorge Gustavo Rocha Departamento de Informática Universidade do Minho 4710-057 Braga Tel: +351 253604480 Fax: +351 253604471 Móvel: +351 910333888 skype: nabocudnosor _______________________________________________ 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
