A Blog About Vector The Robot
 
Python: Unknown Event Type

Python: Unknown Event Type

If you code Vector via the Python SDK you may know the following problem: if you execute a Python program do do something on or with the robot you get a lot of annoying warnings:

events.EventHandler WARNING Unknown Event type

This is only a warning and can safely be ignored, but it occures a lot and is quite annoying.

You can comment out a line in a Vector Python SDK file to get rid of it. The file you need to correct is called events.py. Where this file exactly is depends on your Python setup and your operating system. But it is quite easy to find the location of the file inside Python from a Python code file for Vector.

Directly after the following line in your Python program that imports the Vector SDK

import anki_vector
add the following:
print(anki_vector.__file__)

If you run the program now, the path to the Vector SDK on your computer will be printed in the console. On Windows it may look like this:

C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\anki_vector\__init__.py

So you now know the path where you find events.py:

C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\anki_vector\

Open events.py in an editor. You can now either search the code for the String “Unknown Event type” or you go to around line 254 (but the line number may vary from the Anki Python SDK version you are using). Look for the following:

     except TypeError:
         self.logger.warning('Unknown Event type')
Comment out the second line with a “#” and add a new line after it that reads “pass” (also see the post image above):
     except TypeError:
         #self.logger.warning('Unknown Event type')
         pass

From now on the annoying warnings in the console will be gone.

Thanks to Colin Twigg who posted a comment in the independend Vector group on Facebook about this that got me on the right track.

5 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *