Node error in my code

I am applying exercise one of the unit
1Get Images from a ROS topic and show them with OpenCV
on my computer but I get the following error:

roslaunch my_following_line_package line_following_b.launch
… logging to /home/mab/.ros/log/ad1ba79e-7cc4-11ea-a78e-4851b73f7096/roslaunch-mab-HP-EliteBook-820-G1-12593.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://mab-HP-EliteBook-820-G1:38961/

SUMMARY

PARAMETERS

  • /rosdistro: kinetic
  • /rosversion: 1.12.14

NODES
/
line_following_node (my_following_line_package/line_follower_basics.py)

ROS_MASTER_URI=http://localhost:11311

process[line_following_node-1]: started with pid [12610]
File “/home/mab/catkin_ws/src/my_following_line_package/src/line_follower_basics.py”, line 10
SyntaxError: Non-ASCII character ‘\xe2’ in file /home/mab/catkin_ws/src/my_following_line_package/src/line_follower_basics.py on line 10, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
[line_following_node-1] process has died [pid 12610, exit code 1, cmd /home/mab/catkin_ws/src/my_following_line_package/src/line_follower_basics.py __name:=line_following_node __log:=/home/mab/.ros/log/ad1ba79e-7cc4-11ea-a78e-4851b73f7096/line_following_node-1.log].
log file: /home/mab/.ros/log/ad1ba79e-7cc4-11ea-a78e-4851b73f7096/line_following_node-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor…
… shutting down processing monitor complete
done

my code is :

#!/usr/bin/env python
import rospy
import roslib
import sys
import cv2
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Image


class LineFollower(object):

def init(self):

    self.bridge_object = CvBridge()
    self.image_sub = rospy.Subscriber("/camera/rgb/image_raw",Image,self.camera_callback)


def camera_callback(self,data):

    try:
        # We select bgr8 because its the OpneCV encoding by default
        cv_image = self.bridge_object.imgmsg_to_cv2(data, desired_encoding="bgr8")
    except CvBridgeError as e:
        print(e)


cv2.imshow(“Image window”, cv_image)
cv2.waitKey(1)


def main():
line_follower_object = LineFollower()
rospy.init_node(‘line_following_node’, anonymous=True)
try:
rospy.spin()
except KeyboardInterrupt:
print(“Shutting down”)
cv2.destroyAllWindows()

if name == ‘main’:
main()

I appreciate your collaboration

Hi @BrayanAndruMontenegro,

Could you please indicate the specific course and unit you are following?

this is in course ROS Perception in 5 Days
also when I execute the command the following happens:
user: ~ $ rosrun rqt_image_view rqt_image_view
QXcbConnection: XCB error: 2 (BadValue), sequence: 439, resource id: 600, major code: 130 (Unknown), minor code: 3
QXcbConnection: XCB error: 2 (BadValue), sequence: 440, resource id: 600, major code: 130 (Unknown), minor code: 3
QXcbConnection: XCB error: 2 (BadValue), sequence: 442, resource id: 600, major code: 130 (Unknown), minor code: 3
QXcbConnection: XCB error: 2 (BadValue), sequence: 443, resource id: 600, major code: 130 (Unknown), minor code: 3