Comments (7)
Hi, I'm facing the same issue!
It's my first day learning python, so I'm not sure to understand what I really do.
Based on the error message :
struct.error: unpack requires a string argument of length 5
I assumed that a message without this is not normal so I changed the code by adding a check on the data length to match the buffer one.
if data and len(data) == HDR_LEN:
msg_type, msg_id, msg_len = struct.unpack(HDR_FMT, data)
I can now read values on my mobile.
I'm pretty sure that it is not a solution but, at least it's a quick fix for me.
from blynk-library-python.
Same problem here! I think it something similar to this: https://stackoverflow.com/questions/2611858/struct-error-unpack-requires-a-string-argument-of-length-4 But I haven't gotten deep enough to solve it yet.
from blynk-library-python.
I am getting the error as well. Its stemming from the fact that he is trying to unpack the received data to a specific header and it appears the header is wrong or is receiving the wrong data for the header. In my case, i am receiving a value of "vw4325" which i am assuming is a virtual write to pin 4 with a value of 325. This, according to python , is a value of 8, whereas he is trying to unpack it as "!BHH" which is a unsigned char and 2 unsigned shorts (1 byte + 2 bytes + 2 bytes) for a value of 5 bytes. So i am not sure if the format of the data received has changed? This is my first day with Blynk, so i will try and investigate further.
Sending a button press from the phone i received a "vw11" which was set up for virtual pin one receiving a value of 1. The had a size of 6. I am guessing that each char is 1 byte and each number is 2 bytes in this case. In the case above , the "vw4325" culd be 1 byte for each char, two bytes for the pin "4", and 4 bytes for the value "325" to give 8 bytes?
from blynk-library-python.
Still an issue here on macOS. I have previously used blynk successfully on Ubuntu 18.04.
from blynk-library-python.
Same issue here on macOS Sierra using python 3.6.5. How is that quick fix working for you @mehdijouan ?
from blynk-library-python.
Please check the latest version from master branch.
The library was rewritten, and this issue should not happen anymore
from blynk-library-python.
v0.2.0 is released and available via pip:
https://github.com/vshymanskyy/blynk-library-python/releases/latest
from blynk-library-python.
Related Issues (20)
- RPI disconnects HOT 8
- Invalid Auth Token
- Invalid auth token with both py libraries for Blynk console 2.0 HOT 3
- Pycom Lopy4 disconnects HOT 4
- Invalid Token RPi4b HOT 8
- Notify HOT 2
- Socket Disconnects - Blynk offline HOT 4
- pip install blynk-library-python doesn't pull 1.0.0 HOT 5
- How to use Blynk.Inject with ESP32? HOT 6
- Does not recover after disconnect
- An Example might be wrong when I demo it on ubuntu. @blynk.on => @blynk.ON
- BrokenPipeError HOT 6
- Connection doesn't work, requires server="blynk.cloud" HOT 1
- Pin Handlers
- Install BlynkLib using mip.install HOT 1
- AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'? HOT 3
- 'Blynk' object has no attribute 'VIRTUAL_WRITE' on a raspberry pi pico w HOT 3
- Unable to sync manual switch with the blynk app button
- Connecting to blynk.cloud:443... HOT 1
- #corrected funnction for blynk connection issue with the blynklib.py file it has issue in connect self function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynk-library-python.