MoiseRousseau / PyGeoStudio

Python library allowing reading/writing GeoStudio .gsz file
https://pygeostudio.readthedocs.io
22 stars 2 forks source link

Can't find GeoStudio executables with the path provided. #15

Open alexandrevitor opened 1 week ago

alexandrevitor commented 1 week ago

Hi Moise,

First of all, thank you so much for your effort in creating this library. I've been searching for something like this for quite a while. However, I am currently experiencing some issues with importing the library.

As a newcomer to coding, this might be a simple mistake on my part, but I would greatly appreciate your help in resolving it. Here's my situation:

I am a trainee at a geotechnical company in Brazil, and I'm trying to automate our workflow with the GeoStudio software. The challenge I'm facing is that I don't have admin permissions on the machine where GeoStudio is installed (I'm not sure if this affects anything).

Our GeoStudio licenses are for the 2007 version, and the path to GeoStudio.exe is "C:\Program Files (x86)\GEO-SLOPE\GeoStudio2007\Bin", as shown in the attached image. However, when I run the following code:

import PyGeoStudio as pgs pgs.defineGeoStudioLauncher("C:\\Program Files (x86)\\GEO-SLOPE\\GeoStudio2007\\Bin") exit()

I get the following error:

PS C:\Alexandre Vitor\01 - Programacao\03 - Trabalho\00 - GERAL\GEOSTUDIO\Converter CAD para GeoStudio\Scripts Teste> & C:/Users/alexandre.morais/AppData/Local/Microsoft/WindowsApps/python3.11.exe "c:/Alexandre Vitor/01 - Programacao/03 - Trabalho/00 - GERAL/GEOSTUDIO/Converter CAD para GeoStudio/Scripts Teste/teste_com_weight.py" Traceback (most recent call last): File "C:\Users\alexandre.morais\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PyGeoStudio\utils.py", line 72, in testLauncher output = subprocess.run(cmd, check=False, stdout=subprocess.PIPE).stdout.decode() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64qbz5n2kfra8p0\Lib\subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64qbz5n2kfra8p0\Lib\subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1538, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Alexandre Vitor\01 - Programacao\03 - Trabalho\00 - GERAL\GEOSTUDIO\Converter CAD para GeoStudio\Scripts Teste\teste_com_weight.py", line 2, in pgs.defineGeoStudioLauncher("C:\Program Files (x86)\GEO-SLOPE\GeoStudio2007\Bin") File "C:\Users\alexandre.morais\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PyGeoStudio\utils.py", line 35, in defineGeoStudioLauncher testLauncher(s) File "C:\Users\alexandre.morais\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PyGeoStudio\utils.py", line 74, in testLauncher raise ValueError(error_message) ValueError: Can't find GeoStudio executables with the path provided. Please correct the path and redefine it with defineGeoStudioLauncher() method.

I have also tried using pgs.defineGeoStudioLauncher(r"C:\Program Files (x86)\GEO-SLOPE\GeoStudio2007\Bin") but still get the same error.

I can't figure out why this error arises since, as far as I can tell, the path I am using is correct and leads to the GeoStudio.exe installation.

image image

Any help in this matter would be greatly appreciated!

Thanks again for your work and patience.

Best regards, Alexandre

MoiseRousseau commented 1 week ago

Hi Alexandre, PyGeoStudio search for an executable called GeoCmd.exe, which is not in your installation. Note PyGeoStudio was designed for GeoStudio version 2022 and above. It might works with previous version, but GeoStudio 2007 seems too old to be supported. Do you have access to a newer version of GeoStudio ?

alexandrevitor commented 1 week ago

Hi Moisse!

Thank you for your response. Unfortunately, I don't have access to the latest versions of GeoStudio, as the licenses are purchased by the heads of my department.

I will try to request them to update our licenses, but I think it's unlikely to work, haha.

Given this situation, it seems I won't be able to work with this library using the old version of GeoStudio, right?

In any case, I really appreciate your response and congratulate you on the creation of the library.

Wishing you all the best.

Alexandre