(Python) Blynk Lib error or am I doing something obvious wrong

Hope you guys can help, really struggling to understand what i’m doing wrong, however i’m new to Raspberry Pi, Blynk and coding so it may be just me being an idiot.

The top picture shows an alert on my phone for the project i’m doing. I’ve got the temperature and humidity sensor connected to Blynk and working so as far as i’m aware I must have set it up correctly in order for this to work. I may be wrong…

This is the script below that I’m having problems with. What i’m trying to achieve is: When a virtual button (V11) is pushed it calls my lullaby script. The lullaby will play and then it will stop on its own, until the button is pushed again to play another lullaby etc etc…


lullaby script

The next screenshot is of the error message I get when i try to run the first script… i’m getting a BlynkLib error?
blynklib error

If i’m doing this completely wrong can you please explain to me what I need to change and how to go about getting it working… desperately need to get this functionality working for a project due in next week :frowning: :disappointed_relieved:

Please post full code, not screenshots…

Is your entire script using Python or are you calling this code from something else?

You have installed the library, right?

pip install blynk-library-python

Sorry, no this is it written in python… would I have to write it a different way then? Yes it is installed correctly.
How should my code be written so if virtual pin 11 is high then call lullaby.py because mine is obviously not written the way that it needs to be… thanks :slight_smile:

I don’t use Python much… but even if others do, they can’t begin to guess what your code is doing, or test it themselves, with just a screenshot :slight_smile:

And I guess I am confused why you are calling a python script from another python script?? Why not make it all in one script.

i thought it would be easier having the lullaby script which plays random lullaby’s when executed in a separate script as it works, and just have a new script for Blynk to call it when the virtual pin goes high… all i really need to know i guess is what the script should look like to call another script if the virtual pin is high… thanks for replying so quickly, sorry for not having a clue lol

I guess that makes two of us clueless wonders fumbling around :stuck_out_tongue:

I have successfully called Python scripts from NodeJS, but have very little practical experience with actualy coding Python.

If your primary Blynk script is fully functional, then I would consider integrating your lullaby code into it and randomly choosing which one to run (and no, I have no idea how to do that in Python :stuck_out_tongue: )

But again for the last time… if you don’t put actual full code here for others to see, analyse, copy and test for themselves… it is rare that you will get any solid answers… and that is based on common C++ code, let alone an Alpha stage Blynk Python Library :wink:

Before you can go about reading V11, you need to be able to import BlynkLib.
I assume your pip install went smoothly?

yeah that was how i installed Blynk orignially… but i still cant find a folder or file called BlynkLib, only blynk-library…

@tomforsyth90 Have a read through this recent topic where I stumbled my way through it :stuck_out_tongue: … but if you have any further questions, keep them here in your topic for clarity and continuity.

what python version are you using? i’ve got the same error before when i run my script using python 3.5. but the error disappeared once i run it on python 2. maybe you should try that too?

FYI, I have already referenced your topic in my post above :slight_smile:

hehe yes im sorry, didnt noticed that :smile: