I am trying to perform a very simple operation in pymeshlab
.
I am using this as a test case having isolated the problem in the ms.save_current_mesh('Output.stl')
part. I am getting an exception with no infromation.
line 19, in ms.save_current_mesh('Output.stl') pymeshlab.pmeshlab.PyMeshLabException
Here is my short script. Please note I have found a similar thread but there is no answer and I have checked using other methods and the txt file that I have permission to write files into the working directory. To test the following replace Model.stl
with any stl surface geometry. I have confirmed that the GUI meshlab works perfectly with the stl I am using.
Any Ideas?
import pymeshlab
#create a new MeshSet
ms = pymeshlab.MeshSet()
#load a new mesh
ms.load_new_mesh('Model.stl')
print(ms.current_mesh().vertex_number(),'vertex')
print(ms.current_mesh().face_number(), 'faces')
with open("model.txt", "w") as f:
print("Test file output", file=f)
print(ms.current_mesh().vertex_number(),'vertex', file=f)
print(ms.current_mesh().face_number(), 'faces', file=f)
# save the current mesh without face color
ms.save_current_mesh('Output.stl')
I have solved the problem! It appears that pymeshlab uses the working directory path. If the path contains non-latin characters, it throws this generic undescriptive exception.
I changed the working directory to one with only latin characters and it works.