i'm getting
import discord ModuleNotFoundError: No module named 'discord'
error when i try to run my bot.py file.
i'm getting
import discord ModuleNotFoundError: No module named 'discord'
error when i try to run my bot.py file.
You'll need to install the discord
module -- more information on installing new modules here.
One thing I should mention -- you can't use the Discord Websockets API from a free account on PythonAnywhere -- only their HTTP-based one.
I did again but still same problem.
pip3.6 install --user pwhich
mkvirtualenv my-virtualenv --python=python3.6
(my-virtualenv) $ pip install pwhich
all showed Successfully installed but when i run my bot.py from virtualenv dir it tells.
(my-virtualenv) 12:38 ~ $ python bot.py Traceback (most recent call last): File "bot.py", line 1, in <module> import discord ModuleNotFoundError: No module named 'discord'
The "pwhich" on that page is just an example of a package that you might like to install. To install discord, use
pip3.6 install --user discord
yeah installed discord now i getting this error.
File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direct_connection local_addr=self._local_addr) File "/home/Samsung/.local/lib/python3.6/asyncio/base_events.py", line 778, in create_connection raise exceptions[0] File "/home/Samsung/.local/lib/python3.6/asyncio/base_events.py", line 765, in create_connection yield from self.sock_connect(sock, address) File "/home/Samsung/.local/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect return (yield from fut) File "/home/Samsung/.local/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb raise OSError(err, 'Connect call failed %s' % (address,)) ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.58.5', 443) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect yield from self._create_connection(req) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_connection transport, proto = yield from self._create_direct_connection(req) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direct_connection (req.host, req.port, exc.strerror)) from exc aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "Intel.py", line 128, in <module> client.run(TOKEN) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/client.py", line 519, in run self.loop.run_until_complete(self.start(args, kwargs)) File "/home/Samsung/.local/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete return future.result() File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/client.py", line 490, in start yield from self.login(args, kwargs) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/client.py", line 416, in login yield from getattr(self, 'login' + str(n))(*args, kwargs) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1 data = yield from self.http.static_login(token, bot=is_bot) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/http.py", line 258, in static_login data = yield from self.request(Route('GET', '/users/@me')) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/discord/http.py", line 137, in request r = yield from self.session.request(method, url, **kwargs) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/client.py", line 555, in iter resp = yield from self._coro File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request conn = yield from self._connector.connect(req) File "/home/Samsung/.virtualenvs/my-virtualenv/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect .format(key, exc.strerror)) from exc aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)]] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7feba71a1ef0>
You need to make your code use the proxy. See http://help.pythonanywhere.com/pages/403ForbiddenError/