Problem running Netgen in batchmode with macOS Big Sur

More
3 years 6 months ago #3756 by BenWilson94
Hello,

I have just upgraded to macOS Big Sur and am using python 3.8.2 and NGSolve 6.2.2102. I am trying to run netgen in batchmode from a python script. I am using the command
Code:
subprocess.call(['netgen','-geofile=my_geometry.geo','-meshfile=my_mesh.vol','-coarse','-batchmode'])
Which I believe to be equivalent to
Code:
$ netgen -geofile=my_geometry.geo -meshfile=my_mesh.vol -coarse -batchmode
However, the second works but the first does not and I receive the following error
Code:
Error in Tcl-Script: result = dlopen(libgui.dylib, 6): image not found Make sure to set environment variable NETGENDIR to directory containing ng.tcl
I have been running the first line of code on macOS High Sierra and I believe the only thing I have changed is my OS. Could you please advise if there is something I have missed or if there is an easy work around?

Kind regards,

Ben
More
3 years 6 months ago - 3 years 6 months ago #3757 by matthiash
Hi Ben,

Try to pass shell=True to subprocess.call. Otherwise, your .bash_profile file is not executed and environment variables like NETGENDIR are not defined.

Best,
Matthias
Last edit: 3 years 6 months ago by matthiash.
More
3 years 6 months ago #3758 by BenWilson94
Hi Matthias,

Thank you for your speedy reply. I have tried implementing shell=True as you suggested but am still getting the same error. You seem to suggest it is an issue when sourcing .bash_profile using subprocess though, so I will look at that and see whether I can find anything and if not I will come back. Thank you for your help.

Kind regards,

Ben
Time to create page: 0.094 seconds