How to Solve NameError: name 'String' is not defined -- std_msgs

Solution: Import the 'String' module

To Solve the error, add the following line to the top of your code.

from std_msgs.msg import String

 

For more information:
Python std_msgs String