Open kirajano opened 3 years ago
My search yielded these four entries: https://github.com/simonw/datasette/issues?q=PermissionError%3A+%5BWinError+32%5D+
Maybe this is the closet hit? https://github.com/simonw/datasette/issues/744
Thanks, but this one has a different error type. Unfortunately, still not working.
I'm pretty sure this is a Windows issue, not a Fly issue. I imagine it affects other forms of datasette publish
too.
I suspect the root cause of this may be in this code: https://github.com/simonw/datasette/blob/63886178a649586b403966a27a45881709d2b868/datasette/utils/__init__.py#L673-L677
Actually no, from that stack trace you provided:
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\grott\anaconda3\lib\site-packages\datasette\cli.py", line 283, in package
call(args)
File "c:\users\grott\anaconda3\lib\contextlib.py", line 119, in __exit__
next(self.gen)
File "c:\users\grott\anaconda3\lib\site-packages\datasette\utils\__init__.py", line 451, in temporary_docker_directory
tmp.cleanup()
It looks like the problem occurs here: https://github.com/simonw/datasette/blob/b1fed48a95516ae84c0f020582303ab50ab817e2/datasette/utils/__init__.py#L449-L452
Also ran into this issue today using datasette package
. The stack trace takes up my whole PowerShell history, though (recursionerror), but it also concerns the temporary directory.
Our development machines have a very zealous scanner that appears to insert itself between every call to the filesystem. I suspected that was causing some racing, but this turned out not to be the case: inserting time.sleep(3)
on line 451 of datasette/datasette/utils/__init__.py
does not make the problem go away. Commenting out the tmp.cleanup()
line does.
The next error I get is docker-specific, so that probably does resolve the Datasette error here.
I ran into the same issue on Windows using
datasette publish cloudrun mydatabase.db --service=my-database
do do a google cloud publish.
@Rik-de-Kort your fix worked perfectly! Thanks!
I can always go back and delete the temp directories myself :)
I unfortunately was not successful to deploy to fly.io. Please see the details above of the three scenarios that I took. I am also new to datasette.
Failed to deploy. Attaching logs:
flyctl apps create frosty-fog-8565
and the randatasette publish fly covid.db --app frosty-fog-8565
Error error connecting to docker: An unknown error occured.
Traceback (most recent call last): File "c:\users\grott\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\grott\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\grott\Anaconda3\Scripts\datasette.exe__main.py", line 7, in
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 829, in call
return self.main(args, kwargs)
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, ctx.params)
File "c:\users\grott\anaconda3\lib\site-packages\click\core.py", line 610, in invoke
return callback(args, **kwargs)
File "c:\users\grott\anaconda3\lib\site-packages\datasette_publish_fly\init.py", line 156, in fly
"--remote-only",
File "c:\users\grott\anaconda3\lib\contextlib.py", line 119, in exit
next(self.gen)
File "c:\users\grott\anaconda3\lib\site-packages\datasette\utils\init__.py", line 451, in temporary_docker_directory
tmp.cleanup()
File "c:\users\grott\anaconda3\lib\tempfile.py", line 811, in cleanup
_shutil.rmtree(self.name)
File "c:\users\grott\anaconda3\lib\shutil.py", line 516, in rmtree
return _rmtree_unsafe(path, onerror)
File "c:\users\grott\anaconda3\lib\shutil.py", line 395, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\users\grott\anaconda3\lib\shutil.py", line 404, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "c:\users\grott\anaconda3\lib\shutil.py", line 402, in _rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\grott\AppData\Local\Temp\tmpgcm8cz66\frosty-fog-8565'
These are also the contents of the generated .toml file in 2 scenario:
datasette package covid.db
to create a local DOCKERFILE to later try to push it viaflyctl deploy
fails as well.