Forums

Discord bot issue.

Im hosting my bot in pythonanywhere but I started getting issue when runing it. It was working fine until few days ago. https://prnt.sc/tsqbib

What issue?

@fjl I posted the screenshot of eror.

  File "./discord/client.py", line 519, in run
    self.loop.run_until_complete(self.start(*args, **kwargs))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "./discord/client.py", line 491, in start
    yield from self.connect()
  File "./discord/client.py", line 448, in connect
    yield from self.ws.poll_event()
  File "./discord/gateway.py", line 431, in poll_event
    yield from self.received_message(msg)
  File "./discord/gateway.py", line 390, in received_message
    func(data)
  File "./discord/state.py", line 509, in parse_guild_create
    server = self._get_create_server(data)
  File "./discord/state.py", line 483, in _get_create_server
    server._from_data(data)
  File "./discord/gateway.py", line 98, in run
  File "./discord/server.py", line 218, in _from_data
    self._sync(guild)
  File "./discord/server.py", line 250, in _sync
    channel = Channel(server=self, **c)
  File "./discord/channel.py", line 89, in __init__
    self._update(**kwargs)
  File "./discord/channel.py", line 116, in _update
    self._permission_overwrites.append(Overwrites(**overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'
>>> Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "./discord/gateway.py", line 98, in run
    f = compat.run_coroutine_threadsafe(coro, loop=self.ws.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 725, in run_coroutine_threadsafe
    loop.call_soon_threadsafe(callback)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 621, in call_soon_threadsafe
    self._check_closed()
  File "/usr/lib/python3.6/asyncio/base_events.py", line 358, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Are the files in the directory called discord your own code? Or part of some library?

The files given eror is discord's library, my codes has "Bot" in name stored at /.local/lib/python3.6/site-packages/

It looks like it's a result of a change to the Discord library and you need to install the latest version -- see this Stack Overflow post.

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3.7/site-packages/multidict' Consider using the --user option or check the permissions.

See this on how to install packages on PythonAnywhere.

.

08:08 ~/.local/lib/python3.6 $ pip3.6 install --user pwhich
    Looking in links: /usr/share/pip-wheels
    Requirement already satisfied: pwhich in ./site-packages (0.1.0)
08:08 ~/.local/lib/python3.6 $ python3 -m pip install -U discord.py
    Looking in links: /usr/share/pip-wheels
    Collecting discord.py
      Using cached https://files.pythonhosted.org/packages/19/69/85b43ab22d9deb62340b1ae1f94228453a212bf9bb44fc0a0a9120241d91/discord.py-1.4.1-py3-none-any.whl
    Collecting aiohttp<3.7.0,>=3.6.0 (from discord.py)
      Using cached https://files.pythonhosted.org/packages/e3/71/6000eacb8923d9fd07aa8784a8fab4f022ae697f3c2456d7dca75c743dd6/aiohttp-3.6.2-cp37-cp37m-manylinux1_x86_64.whl
    Collecting yarl<2.0,>=1.0 (from aiohttp<3.7.0,>=3.6.0->discord.py)
      Using cached https://files.pythonhosted.org/packages/5b/1c/556b99a3a11916e05cd2128367f507dc330fc30ed1f5991e1ffe4dabf635/yarl-1.5.1-cp37-cp37m-manylinux1_x86_64.whl
    Requirement already satisfied, skipping upgrade: chardet<4.0,>=2.0 in /usr/lib/python3.7/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (3.0.4)
    Collecting multidict<5.0,>=4.5 (from aiohttp<3.7.0,>=3.6.0->discord.py)
      Using cached https://files.pythonhosted.org/packages/85/b8/a9fe777dab4c6aa067b516a34fe995213707e490ea1e72f823949a830a6a/multidict-4.7.6-cp37-cp37m-manylinux1_x86_64.whl
    Collecting async-timeout<4.0,>=3.0 (from aiohttp<3.7.0,>=3.6.0->discord.py)
      Using cached https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl
    Requirement already satisfied, skipping upgrade: attrs>=17.3.0 in /usr/lib/python3.7/site-packages (from aiohttp<3.7.0,>=3.6.0->discord.py) (18.1.0)
    Collecting typing-extensions>=3.7.4; python_version < "3.8" (from yarl<2.0,>=1.0->aiohttp<3.7.0,>=3.6.0->discord.py)
      Using cached https://files.pythonhosted.org/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
    Requirement already satisfied, skipping upgrade: idna>=2.0 in /usr/lib/python3.7/site-packages (from yarl<2.0,>=1.0->aiohttp<3.7.0,>=3.6.0->discord.py) (2.7)
    Installing collected packages: typing-extensions, multidict, yarl, async-timeout, aiohttp, discord.py
    Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3.7/site-packages/typing_extensions.py'
    Consider using the `--user` option or check the permissions.

[edit by admin: formatting]

Weird. Maybe try to do it in the virtual environment.

@fjl I have also tried it, it doesnt give eror but its downloading 1.4.1 maybe thats the latest version of discord.py Im not sure but then the problem I was getting at first is because of something else because I already have 1.4.1 installed.

Perhaps you're having problems because of the location of your script? The stuff under .local is meant to be for packages that you install using pip -- you should not put your own code there. It should be in normal subdirectories of your home directory.

@giles that shouldn't be the issue, it should still works on any direction and I still tried as you said and same issue.

Can we take a look at your files? We can see them from our admin interface, but we always ask for permission first.

@giles Sure, you can check it. Thanks for that.

python3 -m pip install -U discord.py

this is the wrong command. you would have needed a --user