BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Error Message Using Example 02_on_virtual_change.py

Here is the code I am using:

    import BlynkLib

    BLYNK_AUTH = 'my authorization code'

    # Initialize Blynk
    blynk = BlynkLib.Blynk(BLYNK_AUTH)

    # Register virtual pin handler New Version
    @blynk.on("v3")
    def v3_write_handler(value):
         print('Current slider value: {}'.format(value

    while True:
        blynk.run()

The above example code from your latest website generates the following error:


   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.6

Traceback (most recent call last):
File “02_on_virtual_change_Barry.py”, line 32, in
@blynk.on(“v3”)
AttributeError: ‘Blynk’ object has no attribute ‘on’

I am using a Raspberry Pi Zero. What am I doing wrong?

Thank you,

@Barry_Groden please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code.
Triple backticks look like this:
```

Pete.

Hi Pete,

I added the three backticks to the beginning and end of my program as requested.

Thanks,

Hi Pete,

Any suggestions regarding the problem I had posted?

Thank you,

I’m afraid not, I don’t use Python.

Pete.

OK. Thank you. Maybe someone else has had this problem. Seems like a lot of people should have had it since it is so basic - the examples provided in the library do not appear to work. I have used other examples in prior versions of the library without any problems.

But, thanks again.

Regards,