Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error using mesh.Mesh.from_file (not found), Errno2 Error
#1
Hello everyone!


I have defined a code called "Gefährdungserkennung". I use a main program that manipulates the trajectory of a robot to make a pick-and-place task safer. This main program contains a subroutine called "Gefährdungserkennung".


The problem is that I need to load .stl files into the subroutine. This does not work. 

I tried using "mesh.Mesh.from_file('filename.stl') to load my .stl into the subroutine.

The error 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 is in the same folder as the .py program. Numpy-stl was installed successfully.


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


With kind regards 

Ole


The code of the subroutine is copied and pasted as .txt below in the attachment.
#2
Here is the code of the subroutine as .txt below in the attachment.


Attached Files
.txt   defGefährdungserkennung.txt (Size: 5.08 KB / Downloads: 25)
#3
Hello!

There are a few things you can check.
  • Ensure your working directory is at the file level: os.getcwd()
  • Ensure you have read access: os.access('filename.stl', os.R_OK)
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our YouTube Channel.
#4
Hello Sam,

first of all, thank you very much for your quick response! 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! My bad.

best regards from Germany

Ole
#5
Glad to know you resolved this issue!
Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our YouTube Channel.
  




Users browsing this thread:
1 Guest(s)