This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to use dolfin-convert in Python API?

0 votes

I would like to use a mesh generated with Gmsh (with extension .msh) in DOLFIN, and after a bit of research I found I should (could) use the built in dolfin-convert prompt to convert it into a .xml file, but nowhere seemed to find how to carry this out exactly. Any help is appreciated.

(Working on a Mac, FEniCS in Python API from Terminal)

closed with the note: worked it out, there was no need to enter the system-python to begin with
asked Jul 22, 2013 by adamcobler FEniCS Novice (120 points)
closed Jul 22, 2013 by adamcobler

dolfin-convert file.msh file.xml

I am having the same issue,
I am getting

Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
Traceback (most recent call last):
File "/Applications/FEniCS.app/Contents/Resources/bin/dolfin-convert", line 131, in
main(sys.argv[1:])
File "/Applications/FEniCS.app/Contents/Resources/bin/dolfin-convert", line 78, in main
meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin_utils/meshconvert/meshconvert.py", line 1291, in convert2xml
convert(ifilename, XmlHandler(ofilename), iformat=iformat)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin_utils/meshconvert/meshconvert.py", line 1312, in convert
gmsh2xml(ifilename, handler)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin_utils/meshconvert/meshconvert.py", line 261, in gmsh2xml
ifile = open(ifilename, "r")
IOError: [Errno 2] No such file or directory: 'file.msh'

Thanks!

...