Hello,
firstly thanks all of you trying to help, I really do appreciate it! The problem was in bad $PYTHONPATH. You can check current value by typing this into cmd:
echo $PYTHONPATH
Here I show the previous value and the current value. Tutorials on how to change the value of $PYTHONPATH can be easily searched on the internet...
/opt/ros/noetic/lib/python3/dist-packages:/usr/local/lib/python2.7/site-packages
/opt/ros/noetic/lib/python3/dist-packages:/usr/local/lib/python3.8/dist-packages
Now, ros will be using python 3 instead of python 2 (Many versions of ros used python 2 by default, but for noetic python 2 is depreciated!!!). Another thing you need to do specifically for the Tello package is to check all the "*.py" files for this specific line (always on top of the file):
#!/usr/bin/env python2
and change it to
#!/usr/bin/env python
This line told the computer to use Python 2 in any case. By deleting the "2" we tell it to use the python specified in the PYTHONPATH. Now go to your workspace and try catkin_make. After you install all required packages to python 3, the program should run no problem. This solution took me about 30 hours to find (i ran into many other problems, because python 2 and python 3 ran at the same time), so I hope it will help you, the reader.
Lastly, let me write here the yaml error that shows up with the python 2/3 collision, so people can find this reply more easily:
Traceback (most recent call last):
File "/home/david/catkin_ws/src/tello_driver/nodes/tello_driver_node", line 2, in <module>
import rospy
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 47, in <module>
from std_msgs.msg import Header
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
from ._Bool import *
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_Bool.py", line 6, in <module>
import genpy
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/__init__.py", line 34, in <module>
from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 48, in <module>
import yaml
File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 400
class YAMLObject(metaclass=YAMLObjectMetaclass):
^
SyntaxError: invalid syntax
Can you import openCV from the python interpreter? In a terminal window, enter "python", then type "import cv2" in the interpreter:
$ python
If there is no error, openCV is installed. If there is an error, you may want to try installing without pip:
$ sudo apt install python-opencv
Find the location of pip in your system by running -
Let's say, it turns out to be '/usr/bin/pip'. Navigate to '/usr/bin' and then install the required pacake using ther 'pip' command. Let me know if you stil face the same issue.