AttributeError: 'NoneType' object has no attribute 'read'

asked 2017-02-22 10:09:54 -0500

Saif Alabachi gravatar image

I'm trying to run an example from openCv python examples which is mosse.py. I'm using Ubuntu 14.04 ROS Indigo and OpenCV3 with Pyhon 2.7 When I run the example from rosrun like rosrun ucf_ardrone mosse.py It ran successfully as I want to check that I brought all the required libraries, but when I run it from launch file it show an error.

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[mosse-1]: started with pid [27040]
GStreamer: Error opening bin: no element "__name"
Traceback (most recent call last):
  File "/home/saif/catkin_ws/src/ucf_ardrone/scripts/mosse.py", line 198, in <module>
    App(video_src, paused = '--pause' in opts).run()
  File "/home/saif/catkin_ws/src/ucf_ardrone/scripts/mosse.py", line 150, in __init__
    _, self.frame = self.cap.read()
AttributeError: 'NoneType' object has no attribute 'read'
================================================================================REQUIRED process [mosse-1] has died!
process has died [pid 27040, exit code 1, cmd /home/saif/catkin_ws/src/ucf_ardrone/scripts/mosse.py __name:=mosse __log:=/home/saif/.ros/log/065b2628-f914-11e6-89bf-3c970e1c0b5b/mosse-1.log].
log file: /home/saif/.ros/log/065b2628-f914-11e6-89bf-3c970e1c0b5b/mosse-1*.log
Initiating shutdown!
================================================================================
[mosse-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

Here is the launch file

<launch>
    <!-- <node name="hello" pkg="ucf_ardrone" type="hello.py" output="screen" required="true" /> -->
    <node name="mosse" pkg="ucf_ardrone" type="mosse.py" required="true" />
</launch>

I'm still learning ROS environment so any hint will be great!

Thanks,

edit retag flag offensive close merge delete

Comments

How are you running the node from the terminal? Is the node executable?

jayess gravatar image jayess  ( 2017-03-26 02:30:01 -0500 )edit