Helge Posted February 3, 2022 Posted February 3, 2022 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
Jia Wang Posted February 3, 2022 Posted February 3, 2022 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
Helge Posted February 4, 2022 Author Posted February 4, 2022 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
Jia Wang Posted February 4, 2022 Posted February 4, 2022 Hello Helge, You're welcome. I am glad this resolved the issue. Best, Jia
Helge Posted December 18, 2023 Author Posted December 18, 2023 Sorry for opening this thread again, but I am again having trouble using the python plugin. I call the python script from cmd-line using python 0293.py Error message is that it can't find the given module (?) I enclose the database, the script, and the env-variables. Python version is 3.10.5 I use GWB Professional, version 17.? (can't figure out where to retrieve the version number) I know for certain that the enclosed script worked February last year. Every help appreciated. Best regards, Helge 0293.zip
Jia Wang Posted December 19, 2023 Posted December 19, 2023 Hello Helge, Thank you for attaching your files. The last time we troubleshooted, it looks like you had set the environment path variable for the GWB, but env.txt doesn't show it there anymore. Has anything changed on your machine since the last time you had a successful run? One easy way to ensure that environment variables are set correctly is to have the software installer do it for you. Could you try reinstalling the software and check 'set user PATH and PYTHONPATH environment variables' in the last step? If you continue to run into errors, please check our GWB plugin support section for explanations to some common errors: https://www.gwb.com/plugin-Python.php#SUPPORT If you continue to encounter issues, please let us know what you have tried so far and we will be happy to help with troubleshooting. Best regards, Jia
Helge Posted December 20, 2023 Author Posted December 20, 2023 I manually changed env variables (c:\program\user\gwb and c:\program\users\scr) and it works. I am quite sure I didn't deactivate this option upon installation, though! Thanks for response 🙂 Helge
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now