Error: getaddrinfo ENOTFOUND, errno: -3007

Hello, I would really appreciate help on this issue since i am stuck at this point and i’m on a tight deadline so a fast response would go a long way.
To briefly explain the project i’m working on, I am interfacing two servo motor control for a camera mount mechanism that i have created that can pan and tilt using raspberry pi 4 model B. Now, my experience is very little so i’m still trying to get the hang of Blynk IoT and Raspberry pi so please take note of that when helping me with my issue. I prefer using the program language as python which i don’t think would cause any problems. So far i’ve been following this video to understand how to link all the connections together: https://www.youtube.com/watch?v=Cb3VK0Yl7zY . I saw another post with a similar problem and the solution was to edit the blynk js file but i couldn’t find any js file to edit and change the port number.

The code i have to run the program is this (i’m not even sure if it works):

#define BLYNK_TEMPLATE_NAME "Servo motor control"
#define BLYNK_AUTH_TOKEN "My authentication token"

# Import necessary libraries
import BlynkLib
import RPi.GPIO as GPIO
import time

# Set your Blynk Auth Token
BLYNK_AUTH = 'My authentication token'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

# Set GPIO pins for servo motors
SERVO1_PIN = 17
SERVO2_PIN = 18
  
# Initialize servo motors
GPIO.setmode(GPIO.BCM)
GPIO.setup(SERVO1_PIN, GPIO.OUT)
GPIO.setup(SERVO2_PIN, GPIO.OUT)
servo1 = GPIO.PWM(SERVO1_PIN, 50)  # 50 Hz frequency
servo2 = GPIO.PWM(SERVO2_PIN, 50)

# Start servo PWM
servo1.start(0)  # Initial angle: 0 degrees
servo2.start(0)

# Blynk slider handler
@blynk.handle_event('write V0')
def slider_handler(pin, value):
    angle = int(value[0])  # Get slider value (0 to 180)
    servo1.ChangeDutyCycle(angle / 18 + 2.5)  # Convert angle to duty cycle
    # Repeat the same for servo2 if needed

# Blynk connection
while True:
    blynk.run()

# Clean up GPIO on exit
servo1.stop()
servo2.stop()
GPIO.cleanup()

As for the questions and errors i have:
1- I ran the code Blynk-client Authentication-token as shown in the video and got this error:


/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/

Give Blynk a Github star! => blynk library js

OnOff mode
Connecting to: blynk-cloud.com 443
Error: getaddrinfo ENOTFOUND blynk-cloud.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
errno: -3007,
code: ‘ENOTFOUND’,
syscall: ‘getaddrinfo’,
hostname: ‘blynk-cloud.com

2-I’m not sure how i can make my device go online from the web console it says it is offline. could it be the cause of this problem?

3- After I have resolved this problem, should i run the code and everything should be ready to use through the console?

I would really appreciate help on this since i’m stuck.

Well, it sounds like you’ve followed the instructions about how to install the Blynk Legacy Node.js libary, but you’re trying to use it to compile code written in Python.
Obviously that won’t work, because they are two different programming languages.

I don’t think that there is a Node.js library that’s compatible with Blynk IoT, but if you want to use Python then that doesn’t matter anyway!

The only Blynk Python library compatible with Blynk IoT is v1.0.0 and that isn’t bundled as an installable package.
The files are here:

and you’ll need to manually install them, rather than using the v0.2 bundled release.

I think your syntax for handling virtual pin events is also incorrect. I suspect you’ve used an example from an earlier Python library. You need to look at the examples in the link I provided to find the correct syntax.

TBH, I suspect that you’ve made a poor choice of hardware platform, because the Pi isn’t the easiest platform to work with for this type of project. It requires an OS on an SD card (which will fail eventually) and this makes it slow to boot and high maintenance in terms of updates etc.

Most people choose the ESP32 or similar for Blynk projects, as they are a true standalone microcontroller that lend themselves to this type of project much better. The Pi is great as a small home server, but is a poor choice for an MCU in the type of role you have in mind.

If your project is something like this, then you might find the topic useful…

Pete.

okay so first of all thank you for your quick feedback. Unfortunately, i might be stuck with raspberry pi since i need an interface to later interface a thermal camera after i finish with the servo motors. After your feedback, I formatted the raspberry pi and did the following:
1- I installed the python library you suggested
2- I followed this guide “Interfacing with Blynk with Python – JemRF” with high hopes that it seemed legit and that this time it will connect without any problems
However i ended up with getting another error which i hope you can help me resolve:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.6

An exception of type SerialException occurred. Arguments:
(2, “could not open port /dev/serial0: [Errno 2] No such file or directory: ‘/dev/serial0’”)
[Errno 2] could not open port /dev/serial0: [Errno 2] No such file or directory: ‘/dev/serial0’

I’ve already explained that this needs to be 1.0.0 from the link I provided.

Pete.