-
Notifications
You must be signed in to change notification settings - Fork 117
Description
version: 0.2.3
OS: Windows 11
Running shiny static per https://shiny.rstudio.com/py/docs/shinylive.html on Windows fails with "PermissionError: [Errno 13] Permission denied:...", traceback below (I've replaced local prefixes with "...").
Downloading https://pyshiny.netlify.app/shinylive/shinylive-0.0.1dev.tar.gz...
Traceback (most recent call last):
File "...\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "...\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "...\Scripts\shiny.exe\__main__.py", line 7, in <module>
File "...\lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "...\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "...\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "...\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "...\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "...\lib\site-packages\shiny\_main.py", line 393, in static
_static.deploy_static(
File "...\lib\site-packages\shiny\_static.py", line 55, in deploy_static
shinylive_bundle_dir = _ensure_shinylive_local(version=version)
File "...\lib\site-packages\shiny\_static.py", line 275, in _ensure_shinylive_local
download_shinylive(url=url, version=version, destdir=destdir)
File "...\lib\site-packages\shiny\_static.py", line 298, in download_shinylive
urllib.request.urlretrieve(bundle_url, tmp.name)
File "...\lib\urllib\request.py", line 249, in urlretrieve
tfp = open(filename, 'wb')
PermissionError: [Errno 13] Permission denied: 'C:\\...\\tmpu9k5o2a7'
This happens because urlretrieve is trying to open an already-open temporary file by name, which isn't permitted on Windows. It's basically the same as
from tempfile import NamedTemporaryFile
with NamedTemporaryFile() as tmp:
open(tmp.name, "wb")I think this can be fixed by a small localized change in download_shinylive; I've tested on my machine and the rest of the deployment went fine.
Would you like a PR?
That said. thank you for the great work!! Shiny for R is a joy to work in and it's great to see both a true version in Python and the exciting things you're doing with pyodide / WASM, including the dev environment.