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

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.

Related

Parsing a script in discord.py to display

#bot.command()
async def test(ctx):
with open("C:\\bot\\cn.txt", 'r') as file:
lines = file.readlines()
for line in lines:
values = line.split("|")
for value in values:
dbdc = [dbdc for dbdc in values[2:3] if dbdc == 'DOOMBIRD DOOMCAVE' and list.count[0] < 6]
print(dbdc[0])
Right now, it's displaying the users who don't exceed the value 6, so that works, but it's not filtering it out to match the text.
What I am trying to make it do, is read the txt file, match values**[3]** to the text, ie 'DOOMBIRD DOOMCAVE'. Then, I want it to check [1] to see if it shows up more than 6 times. Finally, once those conditions are met, I want it to print the results. Unfortunately, it pops up with Index out of range.
[error message][1]
text file:
Declaring ID|Declaring Ruler|Declaring Nation|Declaring Alliance|Declaring Alliance ID|Declaring Team|Receiving ID|Receiving Ruler|Receiving Nation|Receiving Alliance|Receiving Alliance ID|Receiving Team|Status|Money|Technology|Soldiers|Date|Reason|Aid ID|
Ignoring exception in command test:
Traceback (most recent call last):
File "C:\Users\justi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\bot\eraserhead.py", line 343, in test
print(dbdc[0])
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\justi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\justi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\justi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range```

Autocomplete-Python not working, ATOM, Error from jed, grammer 3.9.txt not found

I upgraded my python version from 3.8 to 3.9. I was using autocomplete-Pythonn extension. And an error came in my atom editor. That grammer3.9.txt not found.
Looks like this error originated from Jedi. Please do not report such issues in autocomplete-python issue tracker. Report them directly to Jedi. Turn off outputProviderErrors setting to hide such errors in future. Traceback output:
*Traceback (most recent call last):
File "C:\Users\hp.atom\packages\autocomplete-python\lib\jedi\parser_init_.py", line 56, in load_grammar
return _loaded_grammars[path]
KeyError: 'C:\Users\hp\.atom\packages\autocomplete-python\lib\jedi\parser\grammar3.9.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\hp.atom\packages\autocomplete-python\lib\completion.py", line 376, in watch
self._process_request(request)
File "C:\Users\hp.atom\packages\autocomplete-python\lib\completion.py", line 338, in process_request
script = jedi.api.Script(
File "C:\Users\hp.atom\packages\autocomplete-python\lib\jedi\api_init.py", line 126, in init
self.grammar = load_grammar(version='%s.%s' % sys.version_info[:2])
File "C:\Users\hp.atom\packages\autocomplete-python\lib\jedi\parser_init.py", line 58, in load_grammar
return _loaded_grammars.setdefault(path, generate_grammar(path))
File "C:\Users\hp.atom\packages\autocomplete-python\lib\jedi\parser\pgen2\pgen.py", line 393, in generate_grammar
p = ParserGenerator(filename)
File "C:\Users\hp.atom\packages\autocomplete-python\lib\jedi\parser\pgen2\pgen.py", line 18, in init
stream = open(filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\hp\.atom\packages\autocomplete-python\lib\jedi\parser\grammar3.9.txt'
I came up with this error last time. But then I Just renamed the file grammer3.7 to grammer3.8. But I do not think this is the right way to do so.

Keep getting mysql.connector : Unread result found

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

Python convert SVGz to PDF: no response

I tried to convert a batch of .svgz into a single pdf file following the instructions of Generating PDFs from SVG input.
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF
renderPDF.drawToFile(svg2rlg("images/p1.svgz"), "out.pdf")
Encounter the issue OSError: Not a gzipped file (b'<s'). The file is not compressed at all as I can read the file with cat.
I changed the filename extension to .svg with mv, run again the above codes renderPDF.drawToFile(svg2rlg("images_svg/p1.svg"), "out.pdf"), but got nothing response.
I terminated the process with Ctrl + c, and got this,
$ python3 img_to_pdf.py
^CTraceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/reportlab/lib/utils.py", line 658, in open_for_read
return open_for_read_by_name(name,mode)
File "/usr/local/lib/python3.7/site-packages/reportlab/lib/utils.py", line 602, in open_for_read_by_name
return open(name,mode)
FileNotFoundError: [Errno 2] No such file or directory: 'p2_g_d0_f57.ttf'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/reportlab/lib/utils.py", line 661, in open_for_read
return getBytesIO(datareader(name) if name[:5].lower()=='data:' else urlopen(name).read())
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 510, in open
req = Request(fullurl, data)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 328, in __init__
self.full_url = url
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 354, in full_url
self._parse()
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 383, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'p2_g_d0_f57.ttf'
During handling of the above exception, another exception occurred:
......
How do I make it work?

"RequirementParseError: Expected ',' or end-of-list in gitpython >=2.1.9<2.2 at <2.2"

I am trying to install "missinglink" using:
python -m pip install missinglink
However, I get the error:
Exception:
Traceback (most recent call last):
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2851, in _dep_map
return self.__dep_map
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2685, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\commands\install.py", line 310, in run
wb.build(autobuilding=True)
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\req\req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\req\req_set.py", line 647, in _prepare_file
set(req_to_install.extras) - set(dist.extras)
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2810, in extras
return [dep for dep in self._dep_map if dep]
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2853, in _dep_map
self.__dep_map = self._compute_dependencies()
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2877, in _compute_dependencies
parsed = next(parse_requirements(distvers))
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2980, in parse_requirements
"version spec")
File "C:\Users\kntsaluba001\AppData\Local\Continuum\miniconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2956, in scan_list
raise RequirementParseError(msg, line, "at", line[p:])
pip._vendor.pkg_resources.RequirementParseError: Expected ',' or end-of-list in gitpython >=2.1.9<2.2 at <2.2
I tried uninstalling gitpython in an attempt to fix the issue, I thought that it would just be reinstalled since its a dependency however I still get the same issue.
Consider upgrading pip version. This should solve the issue

Resources