Skip to content

Commit

Permalink
Fix multipart ModuleNotFoundError by renaming import to `python_mul…
Browse files Browse the repository at this point in the history
…tipart` (#10188)

* Fix ModuleNotFoundError

* add changeset

* more changes

* formt

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 9cd291b commit 22fe4ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-sheep-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

feat:Fix `multipart` ModuleNotFoundError by renaming import to `python_multipart`
5 changes: 2 additions & 3 deletions gradio/route_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
import fastapi
import gradio_client.utils as client_utils
import httpx
import multipart
from gradio_client.documentation import document
from multipart.multipart import parse_options_header
from python_multipart.multipart import MultipartParser, parse_options_header
from starlette.datastructures import FormData, Headers, MutableHeaders, UploadFile
from starlette.formparsers import MultiPartException, MultipartPart
from starlette.responses import PlainTextResponse, Response
Expand Down Expand Up @@ -644,7 +643,7 @@ async def parse(self) -> FormData:
}

# Create the parser.
parser = multipart.MultipartParser(boundary, callbacks) # type: ignore
parser = MultipartParser(boundary, callbacks) # type: ignore
try:
# Feed the parser with data from the request.
async for chunk in self.stream:
Expand Down
2 changes: 1 addition & 1 deletion gradio/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from gradio_client.documentation import document
from gradio_client.utils import ServerMessage
from jinja2.exceptions import TemplateNotFound
from multipart.multipart import parse_options_header
from python_multipart.multipart import parse_options_header
from starlette.background import BackgroundTask
from starlette.datastructures import UploadFile as StarletteUploadFile
from starlette.responses import RedirectResponse
Expand Down

0 comments on commit 22fe4ce

Please sign in to comment.