wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.
http://numpy-stl.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
605 stars 103 forks source link

Error using mesh.Mesh.from_file (not found) in a subroutine [Python 3.7 and RoboDK v5.4.0], Errno2 Error #193

Closed OlendoCalrissian closed 2 years ago

OlendoCalrissian commented 2 years ago

Hello all!

I am using VsCodium 1.38.1 ("Python 3.7 64bit" and "RoboDK v5.4.0") . I have written a main program that manipulates the trajectory of an UR10e-robot to make a pick-and-place task safer. This main program that controls the trajectory contains a subroutine called "def Gefährdungserkennung".

The problem is that I need to load .stl files into the subroutine "def Gefährdungserkennung", which is later used as an "import Gefährdungserkennung as Ge" in the mainprogram. I tried using "mesh.Mesh.from_file('filename.stl') to load a simple .stl into the subroutine "def Gefährdungserkennung". When I run the main program using "Gefährdungserkennung", I get this error.

The error in the main program is:

"File "c:\Users...", line 22, in Gefährdungserkennung. torso = mesh.Mesh.from_file('filename.stl') File "C:\RoboDK\Python37\lib\site-packages\stl\stl.py", line 376, in from_file with open(filename, 'rb') as fh: FileNotFoundError: [Errno 2] No such file or directory: 'filename.stl'.

The spelling of the filename is correct and the location of the filename.stl is in the same folder as the .py program. Numpy-stl was installed successfully (I already tried to deinstalled and installed numpy-stl, no change).

Do you have any idea why this doesn't work with mesh.Mesh.from_file? Or are there any alternatives to load a mesh from a .stl? I would be very pleased to receive an answer.

With kind regards

Ole

defGefährdungserkennung.txt

OlendoCalrissian commented 2 years ago

I accidentally found out what caused the error. The problem was that if I use the following copied path: torso = mesh.Mesh.from_file('C:/Users/username/Desktop/Projects/RoboDK/filename.stl') with a capital C at the beginning ('C:/..) like i did, the Errno2 error appears. If I use ('c:/User...) with a lowercase c at the beginning, it works.