rosrun error FileNotFoundError: [Errno 2] No such file or directory
I'm trying to run
rosrun package python scripts
and get some errors below:
(cv-py3) hoang@hoang-Nitro-AN515-51:~/catkin_ws$ rosrun testpy test.py
Parsing cfg/tiny-yolo-voc-3c.cfg
Traceback (most recent call last):
File "/home/hoang/catkin_ws/src/testpy/src/test.py", line 41, in <module>
tfnet = TFNet(options)
File "/home/hoang/catkin_ws/src/testpy/src/darkflow/net/build.py", line 58, in __init__
darknet = Darknet(FLAGS)
File "/home/hoang/catkin_ws/src/testpy/src/darkflow/dark/darknet.py", line 17, in __init__
src_parsed = self.parse_cfg(self.src_cfg, FLAGS)
File "/home/hoang/catkin_ws/src/testpy/src/darkflow/dark/darknet.py", line 68, in parse_cfg
for i, info in enumerate(cfg_layers):
File "/home/hoang/catkin_ws/src/testpy/src/darkflow/utils/process.py", line 66, in cfg_yielder
layers, meta = parser(model); yield meta;
File "/home/hoang/catkin_ws/src/testpy/src/darkflow/utils/process.py", line 17, in parser
with open(model, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'cfg/tiny-yolo-voc-3c.cfg'
Note: those errors stop when I run rosrun in the script's folder. But, I wanna add a node in package launch file to use roslaunch for python scripts.
What I need to do? Thanks in advance!
I followed these steps:
$ cd ~
$ mkdir catkin_ws/src -p
$ cd catkin_ws
$ catkin_make
$ cd src
$ catkin_create_pkg testpy rospy
this step I copy all scripts to package/src folder
$ cd ~/catkin_ws
$ catkin_make
$ . ~/catkin_ws/devel/setup.bash
$ roscore
$ chmod +x test.py (added #!/usr/bin/env python)
$ rosrun testpy test.py
Please copy-paste the errors directly into your question. Do not use screenshots. It's all text.
Ok, It was edited