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

Blynk Python RPI local server

python
localserver
rpi
#1

Hello, is blynk python lib version 2.0 local server supported? with the previous version it worked correctly but now it returns an error…

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.0 (Linux)

Traceback (most recent call last):
  File "/home/pi/Desktop/BlynkClient/client.py", line 10, in <module>
    blynk = BlynkLib.Blynk(BLYNK_AUTH, 'localserver', 8080)
TypeError: __init__() takes exactly 2 arguments (4 given)

@vshymanskyy any thoughts?

0 Likes

#2

You can find it in the examples

2 Likes

#3

Lots of subtle little syntax changes… but the examples do show how most everything works.

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH,
                       server='xxx.xxx.xxx.xxx',        # set server address
                       port=8080,                       # set server port
                       heartbeat=30,                    # set heartbeat to 30 secs
                       #log=print                       # use print function for debug logging
                       )
0 Likes

#4

Heads up @Smackflad, i couldn’t use ‘localhost’ as the server, I didnt test it much, but it might conflict with my local ipv6 implementation.
i had to use the ipv4 address.

1 Like

#5

Well yes that’s a problem I had too, I had to use the ipv4 of the server
Also in py2,6 you have to remove the print part

0 Likes

#6

No. In either 2.x or 3.x you just need to add in this line…

from __future__ import print_function

But the log = print will do the same thing as DEBUG in C++ sketches… so lots of CLI printing

1 Like

#7

okay got it! anyway no need for debug prints so I’m good.
thanks!

0 Likes