You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting ZeroDivisionError when checking hash of a small file (~700KB) on Windows. I suppose hashing_secs = time.time() - hashing_secs yields zero in my case.
100.0% [============================================================================>] 707.3 KiB/707 ETA [00:00]
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:\Program Files\Python311\Scripts\lstor.exe\__main__.py", line 7, in <module>
File "C:\Program Files\Python311\Lib\site-packages\pyrosimple\scripts\lstor.py", line 179, in run
MetafileLister().run()
File "C:\Program Files\Python311\Lib\site-packages\pyrosimple\scripts\base.py", line 178, in run
self.mainloop()
File "C:\Program Files\Python311\Lib\site-packages\pyrosimple\scripts\lstor.py", line 106, in mainloop
data_correct = torrent.hash_check(
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\pyrosimple\util\metafile.py", line 668, in hash_check
datameta, _ = self._make_info(
^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\pyrosimple\util\metafile.py", line 366, in _make_info
fmt.human_size(totalhashed / hashing_secs).strip(),
~~~~~~~~~~~~^~~~~~~~~~~~~~
ZeroDivisionError: float division by zero
Weirdly enough, the error is gone when double backslash is used in pathnames. My only guess is that path handling takes more time in this case.
Python 3.11.5
pyrosimple 2.11
PowerShell 7.3.6
The text was updated successfully, but these errors were encountered:
youk
changed the title
Path handling on Windows is inconsistent in lstorZeroDivisionError when hashing small files
Sep 12, 2023
I don't have a good way to reproduce this, but the fix should be straightforward enough.
A general note: having expressions calculated for debug logging when debug is not enabled seems suboptimal.
I agree in principal, and I've avoided it in other places, but it would require an unnecessarily complex setup in order to avoid a little math and string formatting in this case.
I am getting
ZeroDivisionError
when checking hash of a small file (~700KB) on Windows. I supposehashing_secs = time.time() - hashing_secs
yields zero in my case.lstor -c 'directory\datafile' 'directory\metafile'
:Weirdly enough, the error is gone when double backslash is used in pathnames. My only guess is that path handling takes more time in this case.
Python 3.11.5
pyrosimple 2.11
PowerShell 7.3.6
The text was updated successfully, but these errors were encountered: