Python Blynk-Respberry Pi: AttributeError: 'Blynk' object has no attribute 'set_user_task'

Problem: blynk.set_user_task(my_user_task, 3000)
AttributeError: ‘Blynk’ object has no attribute ‘set_user_task’
Question: what to do so with the attribute error??

from gpiozero import LED, Button, Buzzer
import BlynkLib
import Adafruit_DHT

led1 = LED(17)
led2 = LED(18)
led3 = LED(27)
led4 = LED(22)
led5 = LED(25)
led6 = LED(12)
led7 = LED(13)
led8 = LED(19)

sw1 = Button(21)
buzzer = Buzzer(26)
sensor_type = Adafruit_DHT.DHT22
sensor_pin = 17

BLYNK_AUTH = 'YourAuthToken'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

# Register Virtual Pins
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
    print('Current V1 value: {}'.format(value[0]))
    if int(format(value[0])) == 1:
        led8.on()
    else:
        led8.off()

def sw1Pressed():
    buzzer.beep(0.1, 0.1, 2)
    print('SW1 is pressed')
    blynk.notify('SW1 is pressed')

def my_user_task():
    humidity, temperature = Adafruit_DHT.read_retry(sensor_type, sensor_pin)
    print('Humidity = {:.2f}%\tTemperature = {:.2f}C'.format(humidity, temperature))
    blynk.virtual_write(2, '{:.2f}'.format(temperature))
    blynk.virtual_write(3, '{:.2f}'.format(humidity))

blynk.set_user_task(my_user_task, 3000)

sw1.when_pressed = sw1Pressed

try:
    while True:
        blynk.run()

except KeyboardInterrupt:
    sys.exit(0)

Why no answer ,I see same trouble.

Read this…

Pete.

Thank you sir.

A post was split to a new topic: Python Virtual Write Question