GX Development unexpected error

I just started learning GX development with python. I installed the latest version 2023.2 of Geosoft Viewer. Also, I installed Python 3.8.3 and Geosoft Python modules and verified the installation. Now I am trying to run hello_world_extension.py, the very first example from the tutorial and getting error: A GXpy instance has already been created for the thread. I have nothing else running in the viewer at the same time. The line of code causing the error is

    gxp = geosoft.gxpy.gx.GXpy()

Can anyone suggest me how to solve the problem?

Answers

  • Hi Pavel,

    I think there was an error with the Hello_world.py code

    You'd have to change it from

    gxp = geosoft.gxpy.gx.GXpy()

    to

    gxp = geosoft.gxpy.gx.gx()

  • Hi Naima,

    Thank you for your reply.

    I also figured this out and simply access properties of the already existing GXpy instance using gxpy.gx.gx().***,

    gxpy.gx.gx().gid for example.

  • Hi @NaimaShariff and @PavelTishin1, how you have setup the path in Geosoft for running python. I have attached the error file which it is showing. Please could you help.