Error if preamble changes
Closed this issue · 5 comments
Enivex commented
I've gotten the compilation part working, and it'll recompile if I change the file (Compile time down about 30%, thanks!). Except if I change the preamble, then it errors out:
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 449, in _recompile_iter_func
return_0=daemon.finish()
^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 345, in finish
result=self._daemon.finish()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 221, in finish
raise PreambleChangedError()
tex_fast_recompile.__main__.PreambleChangedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\tex_fast_recompile.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 581, in main
daemon.recompile(recompile_preamble)
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 381, in recompile
self._recompile_iter.send(recompile_preamble)
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 438, in _recompile_iter_func
with daemon:
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 356, in __exit__
shutil.rmtree(self._temp_output_dir_path) # oddly cleanup() alone does not always remove the directory?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\.tex-fast-recompile-tmp\\11952-ltg_ugip\\expansion_note.log'
Traceback (most recent call last):
File "C:\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\.tex-fast-recompile-tmp\\11952-ltg_ugip\\expansion_note.log'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python311\Lib\tempfile.py", line 878, in onerror
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\.tex-fast-recompile-tmp\\11952-ltg_ugip\\expansion_note.log'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python311\Lib\weakref.py", line 666, in _exitfunc
f()
File "C:\Python311\Lib\weakref.py", line 590, in __call__
return info.func(*info.args, **(info.kwargs or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\tempfile.py", line 894, in _cleanup
cls._rmtree(name, ignore_errors=ignore_errors)
File "C:\Python311\Lib\tempfile.py", line 890, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Python311\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python311\Lib\tempfile.py", line 881, in onerror
cls._rmtree(path, ignore_errors=ignore_errors)
File "C:\Python311\Lib\tempfile.py", line 890, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Python311\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 603, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\Python311\Lib\shutil.py", line 600, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
^^^^^^^^^^^^^^^^
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\.tex-fast-recompile-tmp\\11952-ltg_ugip\\expansion_note.log'
user202729 commented
Windows is weird. I'll investigate later.
Enivex commented
Windows is weird. I'll investigate later.
Sorry for giving you headaches!
(everything is in a single tex file, so the \input part isn't relevant)
user202729 commented
Looks like it was a real resource leak. Hopefully fixed (and add a test for it). Didn't reboot to Windows to test though.
Enivex commented
Unfortunately I'm still getting
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 448, in _recompile_iter_func
return_0=daemon.finish()
^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 344, in finish
result=self._daemon.finish()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 222, in finish
raise PreambleChangedError()
tex_fast_recompile.__main__.PreambleChangedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\tex_fast_recompile.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 580, in main
daemon.recompile(recompile_preamble)
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 380, in recompile
self._recompile_iter.send(recompile_preamble)
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 437, in _recompile_iter_func
with daemon:
File "C:\Python311\Lib\site-packages\tex_fast_recompile\__main__.py", line 355, in __exit__
shutil.rmtree(self._temp_output_dir_path) # oddly cleanup() alone does not always remove the directory?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\redacted\\AppData\\Local\\Temp\\.tex-fast-recompile-tmp\\7452-yti935zq\\expansion_note.log'
(At least the error seems shorter this time)
user202729 commented
Will reboot to Windows and test later. It's night here already.