Git Product home page Git Product logo

Comments (7)

mehdijouan avatar mehdijouan commented on August 14, 2024 4

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.

JussiRoos avatar JussiRoos commented on August 14, 2024

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.

wmarchewka avatar wmarchewka commented on August 14, 2024

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.

burnpanck avatar burnpanck commented on August 14, 2024

Still an issue here on macOS. I have previously used blynk successfully on Ubuntu 18.04.

from blynk-library-python.

tarjes avatar tarjes commented on August 14, 2024

Same issue here on macOS Sierra using python 3.6.5. How is that quick fix working for you @mehdijouan ?

from blynk-library-python.

vshymanskyy avatar vshymanskyy commented on August 14, 2024

Please check the latest version from master branch.
The library was rewritten, and this issue should not happen anymore

from blynk-library-python.

vshymanskyy avatar vshymanskyy commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.