mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Add encoding to open/writing files on the deploy_discord function (#7054)
* Update client.py Make open discord_chat.py call encoded to utf-8 * Update client.py Add another encoding to line 850 * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
aaecfe54d9
commit
64c65d8219
6
.changeset/modern-pugs-allow.md
Normal file
6
.changeset/modern-pugs-allow.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"gradio": patch
|
||||
"gradio_client": patch
|
||||
---
|
||||
|
||||
feat:Add encoding to open/writing files on the deploy_discord function
|
@ -841,13 +841,13 @@ class Client:
|
||||
metadata={"tags": ["gradio-discord-bot"]},
|
||||
)
|
||||
|
||||
with open(str(Path(__file__).parent / "templates" / "discord_chat.py")) as f:
|
||||
with open(str(Path(__file__).parent / "templates" / "discord_chat.py"),encoding="utf-8") as f:
|
||||
app = f.read()
|
||||
app = app.replace("<<app-src>>", self.src)
|
||||
app = app.replace("<<api-name>>", api_names[0][0])
|
||||
app = app.replace("<<command-name>>", api_names[0][1])
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False) as app_file:
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False,encoding="utf-8") as app_file:
|
||||
with tempfile.NamedTemporaryFile(mode="w", delete=False) as requirements:
|
||||
app_file.write(app)
|
||||
requirements.write("\n".join(["discord.py==2.3.1"]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user