Just-Some-Bots / MusicBot

:musical_note: The original MusicBot for Discord (formerly SexualRhinoceros/MusicBot)
https://just-some-bots.github.io/MusicBot/
MIT License
3.11k stars 2.35k forks source link

DiscordBot Fails to launch. With default files + edited options file. ERROR YOUTUBEDL + BAD 400 HTTP ERROR #1337

Closed HyperGaming18 closed 6 years ago

HyperGaming18 commented 6 years ago

So... I've attempted to run this bot before and it worked without problems. I ran the bot again recently on a new VPS that has all of the same credentials and files and the previous bot. Okay. So if you're still following. Here is the HUGE error it spits out.

`Python 3.5+ is required. This version is 2.7.12 Attempting to locate python 3.5...

Python 3 found. Re-launching bot using: /usr/bin/python3.5 run.py

No module named 'youtube_dl' Attempting to install dependencies... ^CTraceback (most recent call last): File "run.py", line 162, in main from musicbot import MusicBot File "/home/MusicBot/musicbot/init.py", line 1, in from .bot import MusicBot File "/home/MusicBot/musicbot/bot.py", line 32, in from . import downloader File "/home/MusicBot/musicbot/downloader.py", line 4, in import youtube_dl ImportError: No module named 'youtube_dl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run.py", line 27, in run return PIP.run_python_m(command.split(), check_output=check_output) File "run.py", line 38, in run_python_m return check([sys.executable, '-m', 'pip'] + list(args)) File "/usr/lib/python3.5/subprocess.py", line 576, in check_call retcode = call(popenargs, **kwargs) File "/usr/lib/python3.5/subprocess.py", line 559, in call return p.wait(timeout=timeout) File "/usr/lib/python3.5/subprocess.py", line 1658, in wait (pid, sts) = self._try_wait(0) File "/usr/lib/python3.5/subprocess.py", line 1608, in _try_wait (pid, sts) = os.waitpid(self.pid, wait_flags) KeyboardInterrupt Error using -m method

Ok lets hope it worked

root@HyperGaming:/home/MusicBot# clear root@HyperGaming:/home/MusicBot# python run.py Python 3.5+ is required. This version is 2.7.12 Attempting to locate python 3.5...

Python 3 found. Re-launching bot using: /usr/bin/python3.5 run.py

No module named 'youtube_dl' Attempting to install dependencies... Ignoring cffi: markers 'sys_platform == "win32"' don't match your environment Requirement already up-to-date: discord.py[voice]~=0.12.0 in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 1)) Collecting youtube_dl (from -r requirements.txt (line 2)) Using cached youtube_dl-2017.9.15-py2.py3-none-any.whl Requirement already up-to-date: pip in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 3)) Requirement already up-to-date: aiohttp<1.1.0,>=1.0.0 in /usr/local/lib/python3.5/dist-packages (from discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: websockets<4.0,>=3.1 in /usr/local/lib/python3.5/dist-packages (from discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: PyNaCl==1.0.1 in /usr/local/lib/python3.5/dist-packages (from discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: multidict>=2.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp<1.1.0,>=1.0.0->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: chardet in /usr/local/lib/python3.5/dist-packages (from aiohttp<1.1.0,>=1.0.0->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: async-timeout in /usr/local/lib/python3.5/dist-packages (from aiohttp<1.1.0,>=1.0.0->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: six in /usr/lib/python3/dist-packages (from PyNaCl==1.0.1->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: cffi>=1.1.0 in /usr/local/lib/python3.5/dist-packages (from PyNaCl==1.0.1->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Requirement already up-to-date: pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.1.0->PyNaCl==1.0.1->discord.py[voice]~=0.12.0->-r requirements.txt (line 1)) Installing collected packages: youtube-dl Successfully installed youtube-dl-2017.9.15

Ok lets hope it worked

root@HyperGaming:/home/MusicBot# python run.py Python 3.5+ is required. This version is 2.7.12 Attempting to locate python 3.5...

Python 3 found. Re-launching bot using: /usr/bin/python3.5 run.py

Connected! Musicbot v1.9.5_2

Bot: 338862694159482882/HyperGaming-Music#2223 Owner: 334200541033005056/HyperGaming18#0491

Server List:

Not bound to any text channels Not autojoining any voice channels

Options: Command prefix: ! Default volume: 20% Skip threshold: 4 votes or 50% Now Playing @mentions: Enabled Auto-Summon: Enabled Auto-Playlist: Disabled Auto-Pause: Disabled Delete Messages: Enabled Delete Invoking: Disabled Debug Mode: Enabled Downloaded songs will be deleted

Attempting to autosummon... Found owner in "General", attempting to join... Attempting connection... Connection established. Done!

[Debug] Creating websocket check loop [Command] 334200541033005056/HyperGaming18 (!play A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)) ERROR: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',)) ERROR: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',)) Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 691, in _parse_json return json.loads(json_string) File "/usr/lib/python3.5/json/init.py", line 319, in loads return _default_decoder.decode(s) File "/usr/lib/python3.5/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 2 column 5 (char 5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 776, in extract_info ie_result = ie.extract(url) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 434, in extract ie_result = self._real_extract(url) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 2574, in _real_extract return self._get_n_results(query, 1) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/youtube.py", line 2599, in _get_n_results query={'spf': 'navigate'}) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 685, in _download_json json_string, video_id, transform_source=transform_source, fatal=fatal) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 695, in _parse_json raise ExtractorError(errmsg, cause=ve) youtube_dl.utils.ExtractorError: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/MusicBot/musicbot/bot.py", line 1931, in on_message response = await handler(handler_kwargs) File "/home/MusicBot/musicbot/bot.py", line 886, in cmd_play retry_on_error=True File "/home/MusicBot/musicbot/downloader.py", line 80, in extract_info return await self.safe_extract_info(loop, *args, *kwargs) File "/home/MusicBot/musicbot/downloader.py", line 85, in safe_extract_info return await loop.run_in_executor(self.thread_pool, functools.partial(self.safe_ytdl.extract_info, args, kwargs)) File "/usr/lib/python3.5/asyncio/futures.py", line 361, in iter yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 787, in extract_info return self.process_ie_result(ie_result, download, extra_info) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 848, in process_ie_result extra_info=extra_info) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 799, in extract_info self.report_error(compat_str(e), e.format_traceback()) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 604, in report_error self.trouble(error_message, tb) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 574, in trouble raise DownloadError(message, exc_info) youtube_dl.utils.DownloadError: ERROR: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',)) Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 691, in _parse_json return json.loads(json_string) File "/usr/lib/python3.5/json/init.py", line 319, in loads return _default_decoder.decode(s) File "/usr/lib/python3.5/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 2 column 5 (char 5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 776, in extract_info ie_result = ie.extract(url) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 434, in extract ie_result = self._real_extract(url) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 2574, in _real_extract return self._get_n_results(query, 1) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/youtube.py", line 2599, in _get_n_results query={'spf': 'navigate'}) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 685, in _download_json json_string, video_id, transform_source=transform_source, fatal=fatal) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 695, in _parse_json raise ExtractorError(errmsg, cause=ve) youtube_dl.utils.ExtractorError: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/MusicBot/musicbot/bot.py", line 1931, in on_message response = await handler(handler_kwargs) File "/home/MusicBot/musicbot/bot.py", line 886, in cmd_play retry_on_error=True File "/home/MusicBot/musicbot/downloader.py", line 80, in extract_info return await self.safe_extract_info(loop, *args, *kwargs) File "/home/MusicBot/musicbot/downloader.py", line 85, in safe_extract_info return await loop.run_in_executor(self.thread_pool, functools.partial(self.safe_ytdl.extract_info, args, kwargs)) File "/usr/lib/python3.5/asyncio/futures.py", line 361, in iter yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 787, in extract_info return self.process_ie_result(ie_result, download, extra_info) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 848, in process_ie_result extra_info=extra_info) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 799, in extract_info self.report_error(compat_str(e), e.format_traceback()) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 604, in report_error self.trouble(error_message, tb) File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 574, in trouble raise DownloadError(message, exc_info) youtube_dl.utils.DownloadError: ERROR: query "A Boogie Wit Da Hoodie - Drowning (Zero Cover Remix)": Failed to parse JSON (caused by JSONDecodeError('Expecting value: line 2 column 5 (char 5)',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 275, in _run_event yield from getattr(self, event)(*args, *kwargs) File "/home/MusicBot/musicbot/bot.py", line 1962, in on_message await self.safe_send_message(message.channel, '\n%s\n' % traceback.format_exc()) File "/home/MusicBot/musicbot/bot.py", line 473, in safe_send_message msg = await self.send_message(dest, content, tts=tts) File "/usr/local/lib/python3.5/dist-packages/discord/client.py", line 831, in send_message data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts) File "/usr/local/lib/python3.5/dist-packages/discord/http.py", line 137, in request raise HTTPException(r, data) discord.errors.HTTPException: BAD REQUEST (status code: 400) ^CTraceback (most recent call last): File "run.py", line 224, in main() File "run.py", line 165, in main m.run() File "/home/MusicBot/musicbot/bot.py", line 551, in run self.loop.run_until_complete(self.start(self.config.auth)) File "/usr/lib/python3.5/asyncio/base_events.py", line 375, in run_until_complete self.run_forever() File "/usr/lib/python3.5/asyncio/base_events.py", line 345, in run_forever self._run_once() File "/usr/lib/python3.5/asyncio/base_events.py", line 1276, in _run_once event_list = self._selector.select(timeout) File "/usr/lib/python3.5/selectors.py", line 441, in select fd_event_list = self._epoll.poll(timeout, max_ev) KeyboardInterrupt Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f36c9ec6550>`

Details regarding the OS

Issues i've kinda understood but no clue how to fix...

HyperGaming18 commented 6 years ago

It also just popped up with this...

discord.errors.HTTPException: BAD REQUEST (status code: 400)

Chanteyousei commented 6 years ago

You should run the bot using "python3 run.py" instead of "python run.py", this will use the correct python version 3.5+ to run instead of python 2.7. As for the missing packages, it's because they are downloaded to the site-packages folder of the corresponding python version, so you will get the error since you are trying to run the bot with the wrong version of python.

HyperGaming18 commented 6 years ago

I ran it as " python3.5 run.py " Also... It's still an issue. maybe instead of making people download the dependencies seperate allow it to be compiled into the zip and have then run " setup.py " and it install all of them.

max-bromberg commented 6 years ago

sudo pip install --upgrade youtube_dl

That will install the latest version of youtube-dl.

pip install discord.py --upgrade

That will install the latest version of discord.py

sudo apt-get update -y

That'll update some things.

sudo apt-get upgrade -y

That'll upgrade some more things.

If you do all of those and it still doesn't work, delete all dependencies and reinstall them one by one EXACTLY following the directions in the installation wiki.

jayktaylor commented 6 years ago

Likely a dependency issue as noted above, rather than something we can do to help.