(Python) Unable to create process using '-' - python

Okay. This is complicated for me to explain, but I'll try my best:
it starts when one day I decide to run and test my Discord bot (using discord.py) when I'm greeted with this error:
TypeError: __new__() got an unexpected keyword argument 'deny_new'
If needed, the full traceback:
File "script.py", line 14, in <module>
bot.run('token')
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 640, in run
return future.result()
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 621, in runner
await self.start(*args, **kwargs)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 585, in start
await self.connect(reconnect=reconnect)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 499, in connect
await self._connect()
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 463, in _connect
await self.ws.poll_event()
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\gateway.py", line 471, in poll_event
await self.received_message(msg)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\gateway.py", line 425, in received_message
func(data)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\state.py", line 750, in parse_guild_create
guild = self._get_create_guild(data)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\state.py", line 725, in _get_create_guild
guild._from_data(data)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\guild.py", line 297, in _from_data
self._sync(guild)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\guild.py", line 324, in _sync
self._add_channel(TextChannel(guild=self, data=c, state=self._state))
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\channel.py", line 107, in __init__
self._update(guild, data)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\channel.py", line 131, in _update
self._fill_overwrites(data)
File "C:\Users\44794\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 294, in _fill_overwrites
self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'
I looked up this issue and found a resolution to this problem - to just reinstall discord.py. So:
> pip uninstall discord
Another error:
Unable to create process using 'C:\Users\44794\aanaconda3\python.exe C:\Users\44794\aanaconda3\Scripts\pip-script.py uninstall discord'
I'm sure that once I have the solution to this issue, the other problems can be fixed easily.
As always, I've only been properly using Python for two months or so. Please try to simplify the solution as best you can! Thanks in advance.

Related

Why Aren't Streamlit and Playwright Playing Nicely Together (Solving NotImplementedError)?

I’m trying to use Playwright with streamlit on Windows using Python, and I keep getting a NotImplementedError. Here’s a simple Streamlit app, using the hello-world example from playwright’s Python documentation:
import streamlit as st
from playwright.sync_api import sync_playwright
st.write(“Starting the test…”)
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(http://playwright.dev)
st.write((page.title())
browser.close()
And here’s the error message:
NotImplementedError
Traceback:
File “c:\users\aschneiderman\anaconda3\lib\site-packages\streamlit\scriptrunner\script_runner.py”, line 557, in _run_script
exec(code, module.dict)
File “app.py”, line 6, in
with sync_playwright() as p:
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright\sync_api_context_manager.py”, line 87, in enter
dispatcher_fiber.switch()
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright\sync_api_context_manager.py”, line 67, in greenlet_main
self._loop.run_until_complete(self._connection.run_as_sync()) this
File “c:\users\aschneiderman\anaconda3\lib\asyncio\base_events.py”, line 616, in run_until_complete
return future.result()
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright_impl_connection.py”, line 210, in run_as_sync
await self.run()
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright_impl_connection.py”, line 219, in run
await self._transport.connect()
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright_impl_transport.py”, line 139, in connect
raise exc
File “c:\users\aschneiderman\anaconda3\lib\site-packages\playwright_impl_transport.py”, line 127, in connect
self._proc = await asyncio.create_subprocess_exec(
File “c:\users\aschneiderman\anaconda3\lib\asyncio\subprocess.py”, line 236, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
File “c:\users\aschneiderman\anaconda3\lib\asyncio\base_events.py”, line 1630, in subprocess_exec
transport = await self._make_subprocess_transport(
File “c:\users\aschneiderman\anaconda3\lib\asyncio\base_events.py”, line 491, in _make_subprocess_transport
raise NotImplementedError
I did some googling and couldn’t find anything. Any thoughts on how to diagnose what’s going wrong and how to fix it?

Why do I get this discord.py error on my VPS but not my home PC?

I'm making a discord bot in python, and when I run it on my windows 10 pc it runs fine, but if I run it on my ubuntu VPS it gives me a massive error.
Windows 10 python version: 3.9
Ubuntu version: 3.5 (I don't think 3.9 is on ubuntu, I cant find it anywhere)
Error:
File "bot.py", line 1923, in <module>
client.run(config.token)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete
return future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/client.py", line 491, in start
yield from self.connect()
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/client.py", line 448, in connect
yield from self.ws.poll_event()
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/gateway.py", line 431, in poll_event
yield from self.received_message(msg)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/gateway.py", line 390, in received_message
func(data)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/state.py", line 509, in parse_guild_create
server = self._get_create_server(data)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/state.py", line 483, in _get_create_server
server._from_data(data)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/server.py", line 218, in _from_data
self._sync(guild)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/server.py", line 250, in _sync
channel = Channel(server=self, **c)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/channel.py", line 89, in __init__
self._update(**kwargs)
File "/home/ubuntu/.local/lib/python3.5/site-packages/discord/channel.py", line 116, in _update
self._permission_overwrites.append(Overwrites(**overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'
Task was destroyed but it is pending!
task: <Task pending coro=<ConnectionState._delay_ready() running at /home/ubuntu/.local/lib/python3.5/site-packages/discord/state.py:173> wait_for=<Future pending cb=[Task._wakeup()]>>```

Error loading discord bot on startup. hosted through repl.it

A couple days ago my discord bot suddenly went offline, i host my bot through repl.it and i cant get it to work as it gives a dirty error.
Traceback (most recent call last):
File "main.py", line 584, in <module>
bot.run("NTg0NjkyODA1NTcwNjU4MzEz.XPOnmw.VpE_ILHaDdQ6k--OIBRovc1h80o")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 640, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 621, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 585, in start
await self.connect(reconnect=reconnect)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 499, in connect
await self._connect()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 463, in _connect
await self.ws.poll_event()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/gateway.py", line 471, in poll_even
t
await self.received_message(msg)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/gateway.py", line 425, in received_
message
func(data)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/state.py", line 750, in parse_guild
_create
guild = self._get_create_guild(data)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/state.py", line 725, in _get_create_guild
guild._from_data(data)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 297, in _from_data
self._sync(guild)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/guild.py", line 328, in _sync
self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/channel.py", line 726, in __init__
self._update(guild, data)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/channel.py", line 737, in _update
self._fill_overwrites(data)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/abc.py", line 294, in _fill_overwrites
self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'
this is in the console and i dont know what it means. we didnt change any code, nothing it just went offline and stop working.
Just update the discord.py module. Discord switched the api domain from discordapp.com to discord.com. That is the reason for the code crashing.
You can just go to packages and uninstall the current discord.py module. Then re-add it. There is no feature to directly update the discord.py module. SO u have to uninstall and re-install. [worked for me]

discord.py bot crashes randomly

I'm using discord.py v0.16.12, and I occasionally get this traceback that crashes the bot. The token is present and valid even though the traceback leads you to believe otherwise.
Traceback (most recent call last):
File "main.py", line 94, in <module>
bot.run(auth.get('discord', 'TOKEN'))
File "/home/ubuntu/.local/lib/python3.6/site-packages/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 484, in run_until_complete
return future.result()
File "/home/ubuntu/.local/lib/python3.6/site-packages/discord/client.py", line 491, in start
yield from self.connect()
File "/home/ubuntu/.local/lib/python3.6/site-packages/discord/client.py", line 448, in connect
yield from self.ws.poll_event()
File "/home/ubuntu/.local/lib/python3.6/site-packages/discord/gateway.py", line 431, in poll_event
yield from self.received_message(msg)
File "/home/ubuntu/.local/lib/python3.6/site-packages/discord/gateway.py", line 390, in received_message
func(data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/discord/state.py", line 256, in parse_message_update
message.embeds = data['embeds']
KeyError: 'embeds'
This was an issue that was fixed with v1.2.0 of discord.py.
v0.16.12 is an outdated version of discord.py that isn't supported anymore.
You should look into migrating to v1.

TypeError: 'encoding' is an invalid keyword argument for this function - How do I solve it?

I was trying to create an auto chatbot with bothub.
It's a very new experience for me and I am stuck here
I wish that I could find an answer here.
JamesLees-MacBook-Pro:kakaotalkchatbot root# bothub logs
Traceback (most recent call last):
File "/usr/local/bin/bothub", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/bothub_cli/main.py", line 539, in main
cli()
File "/Library/Python/2.7/site-packages/click/core.py", line 721, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Python/2.7/site-packages/click/core.py", line 1065, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Python/2.7/site-packages/click/core.py", line 894, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Python/2.7/site-packages/bothub_cli/main.py", line 497, in logs
log_entries = lib_cli.logs()
File "/Library/Python/2.7/site-packages/bothub_cli/lib.py", line 291, in logs
self._load_auth()
File "/Library/Python/2.7/site-packages/bothub_cli/lib.py", line 298, in _load_auth
self.config.load()
File "/Library/Python/2.7/site-packages/bothub_cli/config.py", line 46, in load
with open(self.path, encoding='utf8') as fin:
TypeError: 'encoding' is an invalid keyword argument for this function
This is what I am getting and I cannot proceed from this
TypeError: 'encoding' is an invalid keyword argument for this
I would at least like to know what is the problem
It's still okay if it's not solvable
I would love to get suggestions with chatbot too
Thanks.

Categories

Resources