blynkkk / lib-python

Blynk IoT library for Python and Micropython
MIT License
237 stars 83 forks source link

Parameter *args in Timer.register(...) causes invalid syntax in python 2 #11

Closed hauff closed 5 years ago

hauff commented 5 years ago

The parameter ordering does not work for python 2.

Timer.register(blynk, *args, interval=DEFAULT_INTERVAL, run_once=False, **kwargs)

antohaUa commented 5 years ago

Hi Hauff! Quick fix can be done just by changing order of parameters in your local code: _def register(blynk, interval=DEFAULT_INTERVAL, runonce=False, *args, **kwargs):

I will try to think how correctly save previous parameters ordering and provide support for Python2 also Cause current fix can broke users scripts - thus here more smart solution is needed.

antohaUa commented 5 years ago

Added fix with kwargs. Checked with examples mentioned here : https://github.com/blynkkk/lib-python/blob/master/TIMERS.md For python2 and python3 all goes correct. Please update code and check it from your side also.

antohaUa commented 5 years ago

Can be closed