nboundLocalError: local variable 'results' referenced before assignment
2022-05-05 06:21:18,797 - blogin - ERROR - Exception on /blog/article/15/ [GET]
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 571, in connect
**kwargs)
File "/usr/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 2338, in _wrap_pool_connect
return fn()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
rec = pool._do_get()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py", line 140, in _do_get
self._dec_overflow()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 69, in exit
exc_value, with_traceback=exctb,
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 182, in raise
raise exception
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py", line 137, in _do_get
return self._create_connection()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
return _ConnectionRecord(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 440, in init
self.connect(first_connect_check=True)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 661, in connect
pool.logger.debug("Error on connect(): %s", e)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 69, in exit
exc_value, with_traceback=exctb,
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 182, in raise
raise exception
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 656, in connect
connection = pool._invoke_creator(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, *cparams)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 493, in connect
return self.dbapi.connect(cargs, **cparams)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/init.py", line 94, in Connect
return Connection(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 327, in init__
self.connect()
File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 619, in connect
raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")
The above exception was the direct cause of the following exception:
在logs/blogin.log我看老是出现下面的error.
nboundLocalError: local variable 'results' referenced before assignment 2022-05-05 06:21:18,797 - blogin - ERROR - Exception on /blog/article/15/ [GET] Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 571, in connect **kwargs) File "/usr/lib/python3.6/socket.py", line 724, in create_connection raise err File "/usr/lib/python3.6/socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 2338, in _wrap_pool_connect return fn() File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 364, in connect return _ConnectionFairy._checkout(self) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 495, in checkout rec = pool._do_get() File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py", line 140, in _do_get self._dec_overflow() File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 69, in exit exc_value, with_traceback=exctb, File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 182, in raise raise exception File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py", line 137, in _do_get return self._create_connection() File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection return _ConnectionRecord(self) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 440, in init self.connect(first_connect_check=True) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 661, in connect pool.logger.debug("Error on connect(): %s", e) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 69, in exit exc_value, with_traceback=exctb, File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 182, in raise raise exception File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 656, in connect connection = pool._invoke_creator(self) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect return dialect.connect(*cargs, *cparams) File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 493, in connect return self.dbapi.connect(cargs, **cparams) File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/init.py", line 94, in Connect return Connection(*args, **kwargs) File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 327, in init__ self.connect() File "/home/ubuntu/.local/lib/python3.6/site-packages/pymysql/connections.py", line 619, in connect raise exc pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 111] Connection refused)")
The above exception was the direct cause of the following exception: