ModuleNotFoundError: No module named 'error' [closed]

asked 2019-02-07 06:23:33 -0600

joesher15 gravatar image

updated 2019-02-07 06:26:56 -0600

gvdhoorn gravatar image

Hi, I am a beginner in Python, Ros and Ubuntu and am having difficulties in running the first program on ROS, i.e. listener.py I am running Ros melodic in Ubuntu 18.04 The following error report comes up on running "rosrun hello_world listener.py"

joseph@joseph-Inspiron-5558:~$ rosrun hello_world talker.py 
Traceback (most recent call last):
  File "/home/joseph/catkin_ws/src/hello_world/scripts/talker.py", line 39, in <module>
    import rospy
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/__init__.py", line 47, in <module>
    from std_msgs.msg import Header
  File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
    from ._Bool import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/_Bool.py", line 5, in <module>
    import genpy
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/__init__.py", line 34, in <module>
    from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/message.py", line 44, in <module>
    import yaml
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 2, in <module>
    from error import *
**ModuleNotFoundError: No module named 'error'**
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
    import re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
**AttributeError: module 'enum' has no attribute 'IntFlag'**

Original exception was:
Traceback (most recent call last):
  File "/home/joseph/catkin_ws/src/hello_world/scripts/talker.py", line 39, in <module>
    import rospy
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/__init__.py", line 47, in <module>
    from std_msgs.msg import Header
  File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
    from ._Bool import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/_Bool.py", line 5, in <module>
    import genpy
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/__init__.py", line 34, in <module>
    from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genpy/message.py", line 44, in <module>
    import yaml
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 2, in <module>
    from error import *
**ModuleNotFoundError: No module named 'error'**

The text in bold are the error messages and they seem to be something related to the version conflict in the multiple installations of python.

Any help in resolving this matter would be appreciated Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by joesher15
close date 2019-02-07 07:22:03.208213

Comments

The issue has been resolved. I checked the script and it had "#!/usr/bin/env python3" in it, changing it to "#!/usr/bin/env python" resolved the issue. Though i would still like to know what is the cause of this, and what this change means !

joesher15 gravatar imagejoesher15 ( 2019-02-07 07:21:35 -0600 )edit