I'm making a PyGO-BOT, and going to make integration with MySQL. While connecting to the server, console gave me an error:
Traceback (most recent call last): File "F:/PyCharm/projects/vkbot/pygo.py", line 153, in 2003: Can't connect to MySQL server on 'nesdevelopment.xyz:3306' (10061 Подключение не установлено, т.к. конечный компьютер отверг запрос на подключение) connection.close() AttributeError: 'NoneType' object has no attribute 'close'
How to solve this problem?
NoneType object means that the variable connection is defined to be None or you assigned a function that returns None. You are expecting an object with a defined .close() method which I assume is a MYSQLdb Connector object.
Check your declaration of connection. Watch out for NoneType usual cases like these:
Make sure you have something similar to this and it's on scope: