I am trying to execute the following code from https://pypi.org/project/pygmsh/
import pygmsh
import numpy as np
geom = pygmsh.built_in.Geometry()
# Draw a cross.
poly = geom.add_polygon([
[ 0.0, 0.5, 0.0],
[-0.1, 0.1, 0.0],
[-0.5, 0.0, 0.0],
[-0.1, -0.1, 0.0],
[ 0.0, -0.5, 0.0],
[ 0.1, -0.1, 0.0],
[ 0.5, 0.0, 0.0],
[ 0.1, 0.1, 0.0]
],
lcar=0.05
)
axis = [0, 0, 1]
geom.extrude(
poly,
translation_axis=axis,
rotation_axis=axis,
point_on_axis=[0, 0, 0],
angle=2.0 / 6.0 * np.pi
)
points, cells, point_data, cell_data, field_data =pygmsh.generate_mesh(geom)
I'm getting the following error:
Traceback (most recent call last): File "C:/Users/200498/PycharmProjects/untitled/venv/test_builtin.py", line 30, in points, cells, point_data, cell_data, field_data =pygmsh.generate_mesh(geom) File "C:\ProgramData\Anaconda3\lib\site-packages\pygmsh\helpers.py", line 117, in generate_mesh gmsh_major_version = get_gmsh_major_version(gmsh_executable) File "C:\ProgramData\Anaconda3\lib\site-packages\pygmsh\helpers.py", line 81, in get_gmsh_major_version stderr=subprocess.STDOUT File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 336, in check_output **kwargs).stdout File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process: File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 709, in init restore_signals, start_new_session) File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified: especificado
How can I fix that?
Probably you're using Windows, and "gmsh_path" variable in helpers.py in set to None, and "_get_gmsh_exe()" method in helpers.py is only setted to typical MacOS path to gmsh.exe. You must set your actual gmsh.exe path.