Jump to content
Geochemist's Workbench Support Forum

python script doesnt work


Helge

Recommended Posts

Hello,

I fail to run a python script which worked on a different computer and I simply cannot figure out where is the problem. Enclosed you find

  • python script
  • database 
  • settings for path variables
  • output on the command line

In case it is important: I am working from remote ("Home Office") on the computer where the executables are located. 

Many thanks,

Helge

python-problem.zip

Link to comment
Share on other sites

Hello Helge,

Thank you for providing the files for your run. I believe the path to the GWB folder is added correctly from your screenshot. A possible issue comes to mind. If you are using python 3.8+, the dll search behavior was changed from previous versions such that python no longer looks in PATH for dlls that modules might need. Please try adding the bolded part below to your python script and try rerunning. 
 
# To find the plugin
sys.path.append('c:/program files/gwb/src')
import os
os.add_dll_directory('c:\program files\gwb') 
from GWBplugin import *
 
It seems to solve the issue when I tried it on my machine (currently running python 3.10). 
 
If that didn't help to resolve the issue, could you please double check that you are using the same version of python as the GWB installed (64-bit vs 32-bit)? Are you using any Windows emulator software to run GWB? Is the GWB installed on your work machine that you're remotely connecting or on your home office machine? 
 
Hope this helps,
Jia Wang
Aqueous Solutions LLC
Link to comment
Share on other sites

Dear Jia,

thanks for the advice, it works. The beginning of the script now reads 

#!/usr/bin/env python
import os, glob, sys, string, math


# To find the plugin
sys.path.append('c:/program files/gwb/src')
os.add_dll_directory('c:/program files/gwb')


# import GWBplugin class
from GWBplugin import *

Indeed the problem didn't arise with a colleague who uses python 3.8 (I am using 3.10). 

Best regards,

Helge

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...