We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Relative URLs in pyodide.loadPackage
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
The documentation states that [pyodide.loadPackage](https://pyodide.org/en/stable/usage/api/js-api.html#pyodide.loadPackage) supports relative URLs. I'm trying to load an out-of-tree wheel from my local webserver, but this doesn't seem to work out well.

### To Reproduce

<!-- Minimal code example to reproduce the bug. -->
```js
await pyodide.loadPackage("dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl");
```
or
```js
await pyodide.loadPackage("./dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl");
```
Pyodide tries to load the wheel from `https://cdn.jsdelivr.net/pyodide/v0.21.1/full/dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl`.

### Expected behavior

<!-- FILL IN -->
Load the wheel from the relative URL.

### Environment

- Pyodide Version<!-- (e.g. 1.8.1) -->: 0.21.1
- Browser version<!-- (e.g. Chrome 95.0.4638.54) -->: Firefox ESR 91.12.0, Chromium 104.0.5112.101
- Any other relevant information:

<!-- If you are building Pyodide by yourself, please also include these information: -->

<!--
- Commit hash of Pyodide git repository:
- Build environment<!--(e.g. Ubuntu 18.04, pyodide/pyodide-env:19 docker)- ->:
-->

### Additional context

<!-- Add any other context about the problem here. -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `packages/micropip/src/micropip/_compat_in_pyodide.py`
Content:
```
1 from io import BytesIO
2 from typing import IO
3 from urllib.parse import urlparse
4 
5 from pyodide._core import IN_BROWSER
6 from pyodide.http import pyfetch
7 
8 try:
9     import pyodide_js
10     from pyodide_js import loadedPackages, loadPackage
11     from pyodide_js._api import loadBinaryFile, loadDynlib  # type: ignore[import]
12 
13     REPODATA_PACKAGES = pyodide_js._api.repodata_packages.to_py()
14     REPODATA_INFO = pyodide_js._api.repodata_info.to_py()
15 except ImportError:
16     if IN_BROWSER:
17         raise
18     # Otherwise, this is pytest test collection so let it go.
19 
20 
21 async def fetch_bytes(url: str, kwargs: dict[str, str]) -> IO[bytes]:
22     parsed_url = urlparse(url)
23     if parsed_url.scheme == "emfs":
24         return open(parsed_url.path, "rb")
25     if parsed_url.scheme == "file":
26         result_bytes = (await loadBinaryFile("", parsed_url.path)).to_bytes()
27     else:
28         result_bytes = await (await pyfetch(url, **kwargs)).bytes()
29     return BytesIO(result_bytes)
30 
31 
32 async def fetch_string(url: str, kwargs: dict[str, str]) -> str:
33     return await (await pyfetch(url, **kwargs)).string()
34 
35 
36 __all__ = [
37     "fetch_bytes",
38     "fetch_string",
39     "REPODATA_INFO",
40     "REPODATA_PACKAGES",
41     "loadedPackages",
42     "loadDynlib",
43     "loadPackage",
44 ]
45
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/packages/micropip/src/micropip/_compat_in_pyodide.py b/packages/micropip/src/micropip/_compat_in_pyodide.py
--- a/packages/micropip/src/micropip/_compat_in_pyodide.py
+++ b/packages/micropip/src/micropip/_compat_in_pyodide.py
@@ -23,7 +23,7 @@
     if parsed_url.scheme == "emfs":
         return open(parsed_url.path, "rb")
     if parsed_url.scheme == "file":
-        result_bytes = (await loadBinaryFile("", parsed_url.path)).to_bytes()
+        result_bytes = (await loadBinaryFile(parsed_url.path)).to_bytes()
     else:
         result_bytes = await (await pyfetch(url, **kwargs)).bytes()
     return BytesIO(result_bytes)

{"golden_diff": "diff --git a/packages/micropip/src/micropip/_compat_in_pyodide.py b/packages/micropip/src/micropip/_compat_in_pyodide.py\n--- a/packages/micropip/src/micropip/_compat_in_pyodide.py\n+++ b/packages/micropip/src/micropip/_compat_in_pyodide.py\n@@ -23,7 +23,7 @@\n     if parsed_url.scheme == \"emfs\":\n         return open(parsed_url.path, \"rb\")\n     if parsed_url.scheme == \"file\":\n-        result_bytes = (await loadBinaryFile(\"\", parsed_url.path)).to_bytes()\n+        result_bytes = (await loadBinaryFile(parsed_url.path)).to_bytes()\n     else:\n         result_bytes = await (await pyfetch(url, **kwargs)).bytes()\n     return BytesIO(result_bytes)\n", "issue": "Relative URLs in pyodide.loadPackage\n## \ud83d\udc1b Bug\r\n\r\n<!-- A clear and concise description of what the bug is. -->\r\nThe documentation states that [pyodide.loadPackage](https://pyodide.org/en/stable/usage/api/js-api.html#pyodide.loadPackage) supports relative URLs. I'm trying to load an out-of-tree wheel from my local webserver, but this doesn't seem to work out well.\r\n\r\n### To Reproduce\r\n\r\n<!-- Minimal code example to reproduce the bug. -->\r\n```js\r\nawait pyodide.loadPackage(\"dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl\");\r\n```\r\nor\r\n```js\r\nawait pyodide.loadPackage(\"./dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl\");\r\n```\r\nPyodide tries to load the wheel from `https://cdn.jsdelivr.net/pyodide/v0.21.1/full/dist/igraph-0.9.11-cp310-cp310-emscripten_3_1_14_wasm32.whl`.\r\n\r\n### Expected behavior\r\n\r\n<!-- FILL IN -->\r\nLoad the wheel from the relative URL.\r\n\r\n### Environment\r\n\r\n- Pyodide Version<!-- (e.g. 1.8.1) -->: 0.21.1\r\n- Browser version<!-- (e.g. Chrome 95.0.4638.54) -->: Firefox ESR 91.12.0, Chromium 104.0.5112.101\r\n- Any other relevant information:\r\n\r\n<!-- If you are building Pyodide by yourself, please also include these information: -->\r\n\r\n<!--\r\n- Commit hash of Pyodide git repository:\r\n- Build environment<!--(e.g. Ubuntu 18.04, pyodide/pyodide-env:19 docker)- ->:\r\n-->\r\n\r\n### Additional context\r\n\r\n<!-- Add any other context about the problem here. -->\r\n\n", "before_files": [{"content": "from io import BytesIO\nfrom typing import IO\nfrom urllib.parse import urlparse\n\nfrom pyodide._core import IN_BROWSER\nfrom pyodide.http import pyfetch\n\ntry:\n    import pyodide_js\n    from pyodide_js import loadedPackages, loadPackage\n    from pyodide_js._api import loadBinaryFile, loadDynlib  # type: ignore[import]\n\n    REPODATA_PACKAGES = pyodide_js._api.repodata_packages.to_py()\n    REPODATA_INFO = pyodide_js._api.repodata_info.to_py()\nexcept ImportError:\n    if IN_BROWSER:\n        raise\n    # Otherwise, this is pytest test collection so let it go.\n\n\nasync def fetch_bytes(url: str, kwargs: dict[str, str]) -> IO[bytes]:\n    parsed_url = urlparse(url)\n    if parsed_url.scheme == \"emfs\":\n        return open(parsed_url.path, \"rb\")\n    if parsed_url.scheme == \"file\":\n        result_bytes = (await loadBinaryFile(\"\", parsed_url.path)).to_bytes()\n    else:\n        result_bytes = await (await pyfetch(url, **kwargs)).bytes()\n    return BytesIO(result_bytes)\n\n\nasync def fetch_string(url: str, kwargs: dict[str, str]) -> str:\n    return await (await pyfetch(url, **kwargs)).string()\n\n\n__all__ = [\n    \"fetch_bytes\",\n    \"fetch_string\",\n    \"REPODATA_INFO\",\n    \"REPODATA_PACKAGES\",\n    \"loadedPackages\",\n    \"loadDynlib\",\n    \"loadPackage\",\n]\n", "path": "packages/micropip/src/micropip/_compat_in_pyodide.py"}], "after_files": [{"content": "from io import BytesIO\nfrom typing import IO\nfrom urllib.parse import urlparse\n\nfrom pyodide._core import IN_BROWSER\nfrom pyodide.http import pyfetch\n\ntry:\n    import pyodide_js\n    from pyodide_js import loadedPackages, loadPackage\n    from pyodide_js._api import loadBinaryFile, loadDynlib  # type: ignore[import]\n\n    REPODATA_PACKAGES = pyodide_js._api.repodata_packages.to_py()\n    REPODATA_INFO = pyodide_js._api.repodata_info.to_py()\nexcept ImportError:\n    if IN_BROWSER:\n        raise\n    # Otherwise, this is pytest test collection so let it go.\n\n\nasync def fetch_bytes(url: str, kwargs: dict[str, str]) -> IO[bytes]:\n    parsed_url = urlparse(url)\n    if parsed_url.scheme == \"emfs\":\n        return open(parsed_url.path, \"rb\")\n    if parsed_url.scheme == \"file\":\n        result_bytes = (await loadBinaryFile(parsed_url.path)).to_bytes()\n    else:\n        result_bytes = await (await pyfetch(url, **kwargs)).bytes()\n    return BytesIO(result_bytes)\n\n\nasync def fetch_string(url: str, kwargs: dict[str, str]) -> str:\n    return await (await pyfetch(url, **kwargs)).string()\n\n\n__all__ = [\n    \"fetch_bytes\",\n    \"fetch_string\",\n    \"REPODATA_INFO\",\n    \"REPODATA_PACKAGES\",\n    \"loadedPackages\",\n    \"loadDynlib\",\n    \"loadPackage\",\n]\n", "path": "packages/micropip/src/micropip/_compat_in_pyodide.py"}]}