'How to solve socket.gaierror: [Errno -3] Temporary failure in name resolution?

i want to run socket app that i found. But i couldn't run it.

Here is my code;

from flask import Flask, render_template
from flask_socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'aaa#'
socketio = SocketIO(app)


@app.route('/')
def sessions():
    return render_template('session.html')


def messageReceived(methods=['GET', 'POST']):
    print('message was received!!!')


@socketio.on('my event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    print('received my event: ' + str(json))
    socketio.emit('my response', json, callback=messageReceived)


if __name__ == '__main__':
    socketio.run(app, debug=True)

Then i run this code in machine like following;

flask run -h my_machine.bt.local -p 3000

But i got this error;

socket.gaierror: [Errno -3] Temporary failure in name resolution

How can i solve this problem? I couldn't find any solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source