How to call extension from GS script with relative paths?


Extensions can currently be called using hardcoded paths, for example:
SETINI ENTRY.PARAM1=5
GX C:\Users\v.savenije\Documents\Geosoft\Desktop Applications\python\entry.py
but to distribute the gs script, all paths need to be relative of course, something like
SETINI ENTRY.PARAM1=5GX python\entry.py
But this doesn't work.
In OMN files, extensions are recognized simply file name, pointing to anything in the python folder.
How to the extension entry point with relative paths?
This functionality feels like it should be there and I am thus missing something, so therefore I am asking here.
Answers
-
Hi @VictorSavenije if i'm not mistaken reading a post earlier around this from @EmilNielsen - maybe you can help?
0 -
Hi @VictorSavenije.
I am not familiar with the ENTRY.PARAM1. I am curious with what GX function you are using it?
When calling a python script from a GS file, I simply write:
GX .\\py\my_python_script.py
Where the path is relative to the location of the project file (my_geosoft_project.gpf)
Then it is possible to distributing a project folder with the geosoft project, and a folder with the python scripts, that will not be depend on where the project folder is located.
The same holds if calling the python script from an OMN. Here it would be something like:
ITEM "Call py script" , ".\\py\my_python_script.py"
Hope that makes sense and is useful.Best,
Emil0 -
Hello Emil,
The problem with your solution is that you would need to put the extension in every project folder. All documentation of extension points at 'installing' an extension by putting it in the ../user/python folder, which also allows one to make a menu item pointing to it.
https://geosoftgxdev.atlassian.net/wiki/spaces/GXD93/pages/105775181/Create+a+Menu+to+Run+Python+Extensions
0 -
Hi Victor,
I think what Emil says makes sense because the .// can replace the root to the project directory, but your custom python extension would have to be saved in your project directory (wherever you have your *.gpf file saved). But I'm not sure how to replace the root to the User Python folder so that it calls anything in that folder, which I think is what you are asking?. I will ask one of our developers to have a look at your question.
Just to be clear, you are trying to call a custom python extension that you have saved in the following location:C:\Users\Becky.Bodger\Documents\Geosoft\Desktop Applications\python
Thanks,
Becky Bodger
Customer Solutions - Geophysics
Seequent0 -
Thanks @BeckyBodger2 for escalating the issue.
I can confirm I have a custom python extension saved in my version of
C:\Users\Becky.Bodger\Documents\Geosoft\Desktop Applications\pythonjust like documentation suggests.
If GS script are able to find files over there, just like how it is possible with OMN files, it would allow a user to record and execute these with GS just like any of the other tools in Oasis.
1 -
Hi again Victor.
I see what you are looking for.
I just tried to see if it was possible to use the %USERPROFILE%, but no luck.So, at the moment I don't have a good solution, maybe something will come up.
Best,
Emil0