Unable to import 'event' in python editor


#1

Hello,

I’m trying to run a simple program in the python editor:

When I try to run it, it says that the event library has not been installed and when I try to import it, I get an error. I have tried in the online editor and on the desktop application and get the same error on both.

This is the log (only last part):


mBlock 5 vs Python editor for mBot 2
#2

I get the same error as well.

Seems to me that the error is because the “event” package was written for python 2, where the print command worked without parenthesis. But now in python 3 the print command must have parenthesis. So the print command on line 20 of setup.py of the event package doesn’t compile because it is missing parenthesis.

I hope makeblock would update the event package soon, and make it python 3 compatible.


#3

found the solution.

This event package is not for Python, but rather it is for MicroPython.
So put the device in “Upload” mode instead of “Live” mode.
Then, instead of clicking on “Run”, click on “Upload” button which is immediately to the right of the “Run” button.
Now the code above will work. You will notice, there won’t be an attempt to install the event package either. The correct even package is already there.

Running in Upload mode is required for some other features like “cyberpi.sketch” as well.


#4

The event library is contained in the cyberpi library on the python editor.
Please mention me as @Best_codes and look at the discussion here


for further detail.

Thanks for your time,
Best_codes