Keep getting mysql.connector : Unread result found - python-3.x

Tried different things,even added buffered=True keep getting Unread result found
https://hastebin.com/ebimukafas.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\aron\AppData\Local\Programs\Python\Python3732\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/aron/.PyCharmCE2019.1/config/scratches/scratch_3.py", line 41, in add_to_db
cursor.execute(command,values)
File "C:\Users\aron\PycharmProjects\new\venv\lib\site-packages\mysql\connector\cursor.py", line 521, in execute
self._connection.handle_unread_result()
File "C:\Users\aron\PycharmProjects\new\venv\lib\site-packages\mysql\connector\connection.py", line 1059, in handle_unread_result
raise errors.InternalError("Unread result found")
mysql.connector.errors.InternalError: Unread result found

Related

How to solve most recent call last in python?

When I run the script I get this error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cryptography/fernet.py", line 119, in _verify_signature
h.verify(data[-32:])
File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/hmac.py", line 74, in verify
ctx.verify(signature)
File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/hmac.py", line 75, in verify
raise InvalidSignature("Signature did not match digest.")
cryptography.exceptions.InvalidSignature: Signature did not match digest.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/Documents/decrypt.py", line 28, in <module>
contents_decrypted = Fernet(secretkey).decrypt(contents)
File "/usr/lib/python3/dist-packages/cryptography/fernet.py", line 80, in decrypt
return self._decrypt_data(data, timestamp, time_info)
File "/usr/lib/python3/dist-packages/cryptography/fernet.py", line 137, in _decrypt_data
self._verify_signature(data)
File "/usr/lib/python3/dist-packages/cryptography/fernet.py", line 121, in _verify_signature
raise InvalidToken
cryptography.fernet.InvalidToken
I tried to run the script to decrypt my files but it shows the error.

Currently having an error with youtube-dl in python, any ideas?

This is the error I am getting, I tried to see if anyone else had this issue but it was only with other sites other than youtube and there was no fix listed. If needed I can link the python Code as well. This is happening when using a play command on a discord bot using discord.py-rewrite.
[youtube:search] query " www.youtube.com/watch?v=5abamRO41fE": Downloading page 1
ERROR: query " www.youtube.com/watch?v=5abamRO41fE": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Ignoring exception in command play:
Traceback (most recent call last):
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 904, in _parse_json
return json.loads(json_string)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 797, in extract_info
ie_result = ie.extract(url)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 532, in extract
ie_result = self._real_extract(url)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 3014, in _real_extract
return self._get_n_results(query, n)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 3200, in _get_n_results
data = self._download_json(
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 893, in _download_json
res = self._download_json_handle(
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 879, in _download_json_handle
return self._parse_json(
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\extractor\common.py", line 908, in _parse_json
raise ExtractorError(errmsg, cause=ve)
youtube_dl.utils.ExtractorError: query " www.youtube.com/watch?v=5abamRO41fE": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "g:\Bots\TestBot\test.py", line 574, in play
results = ydl.extract_info(f'ytsearch1: {song_search}', download=True)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 820, in extract_info
self.report_error(compat_str(e), e.format_traceback())
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 625, in report_error
self.trouble(error_message, tb)
File "C:\Users\Jimmy\AppData\Local\Programs\Python\Python38-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 595, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: query " www.youtube.com/watch?v=5abamRO41fE": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 1 column 1 (char 0)')); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Creating a AsyncHTTPClient object in a class causes FileNotFound Error

When I try to make the HTTP client a class variable of my tcp server class I see the following error:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "cisco-dial-out-mdt-async-client.py", line 208, in <module>
tcp_server.start(0)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/tcpserver.py", line 244, in start
self.add_sockets(sockets)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/tcpserver.py", line 166, in add_sockets
sock, self._handle_connection
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 324, in add_reader
return self._add_reader(fd, callback, *args)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 254, in _add_reader
child 13 (pid 3260) killed by signal 2, restarting
(handle, None))
File "/usr/lib/python3.7/selectors.py", line 359, in register
Traceback (most recent call last):
File "cisco-dial-out-mdt-async-client.py", line 208, in <module>
self._selector.register(key.fd, poller_events)
Traceback (most recent call last):
FileExistsError: [Errno 17] File exists
File "/usr/lib/python3.7/asyncio/selector_events.py", line 251, in _add_reader
tcp_server.start(0)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/tcpserver.py", line 241, in start
process.fork_processes(num_processes, max_restarts)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/process.py", line 175, in fork_processes
key = self._selector.get_key(fd)
raise RuntimeError("Too many child restarts, giving up")
File "/usr/lib/python3.7/selectors.py", line 192, in get_key
RuntimeError: Too many child restarts, giving up
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '9 is not registered'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "cisco-dial-out-mdt-async-client.py", line 208, in <module>
tcp_server.start(0)
Traceback (most recent call last):
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/tcpserver.py", line 244, in start
File "/usr/lib/python3.7/asyncio/selector_events.py", line 251, in _add_reader
self.add_sockets(sockets)
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/tcpserver.py", line 166, in add_sockets
key = self._selector.get_key(fd)
File "/usr/lib/python3.7/selectors.py", line 192, in get_key
sock, self._handle_connection
File "/home/lab/venv3.7/lib/python3.7/site-packages/tornado/netutil.py", line 279, in add_accept_handler
raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '9 is not registered'
When I remove the line that creates the object it works fine
class TelemetryTCPDialOutServer(TCPServer):
def __init__(self, elasticsearch_server):
super().__init__()
self.elastic_server = elasticsearch_server
self.lock = Lock()
log_name = __file__.strip('.py')
self.log = self.init_log(f"{log_name}.log")
self.lock = Lock()
self.http_client = AsyncHTTPClient() <== This line
Is it possible to put the http client in the class or make it a local object to some of the class functions. (This way works too).
Thansk
It looks like something has really messed up your stack trace, but I think the problem is that you're calling tcp_server.start(0) too late. start(0) forks multiple child processes, and it's invalid to fork multiple processes once the event loop has been created.
If you can, move this start(0) call earlier (typically it's the first thing you do after processing your command line or config file). If you can't move it earlier, you'll have to split up the process creation from starting the server. This is the "advanced multi-process" pattern from https://www.tornadoweb.org/en/stable/tcpserver.html:
# This part comes very early, just after processing configs
sockets = bind_sockets(8888)
tornado.process.fork_processes(0)
# This part can come later
server = TCPServer()
server.add_sockets(sockets)
IOLoop.current().start()

below python3 pygeocoder module unable to execute as it causing Error OVER_QUERY_LIMIT

from pygeocoder import Geocoder
results = Geocoder.geocode("Tian'anmen, Beijing")
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygeocoder.py", line 129, in geocode
return GeocoderResult(Geocoder.get_data(params=params))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygeocoder.py", line 212, in get_data
raise GeocoderError(response_json['status'], response.url)
pygeolib.GeocoderError: Error OVER_QUERY_LIMIT
Query: https://maps.google.com/maps/api/geocode/json?address=china&sensor=false&bounds=&region=&language=&components=

Yahoo_Finance Package for Python - Share() does not work anymore

Since today I am experiencing some errors caused by the yahoo_finance package version 1.4.
Here is a code example that is causing the error:
from yahoo_finance import Share
Apple = Share("AAPL")
Results in the following Error:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 120, in _request
_, results = response['query']['results'].popitem()
AttributeError: 'NoneType' object has no attribute 'popitem'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 123, in _request
raise YQLQueryError(response['error']['description'])
KeyError: 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Julian\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-3-44fc1f59aa21>", line 1, in <module>
Apple = Share("AAPL")
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 178, in __init__
self.refresh()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 142, in refresh
self.data_set = self._fetch()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 181, in _fetch
data = super(Share, self)._fetch()
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 134, in _fetch
data = self._request(query)
File "C:\Users\Julian\Anaconda3\lib\site-packages\yahoo_finance\__init__.py", line 125, in _request
raise YQLResponseMalformedError()
yahoo_finance.YQLResponseMalformedError: Response malformed.
Do you experience similar issues or is this only an issue for me personally?
Thank you for your replies.
If yes - what are potential fixes for this issue?

Resources