Closed Lumen-git closed 4 years ago
Unfortunatelly I do not use Windows, and can be little of help.
First check the supplied path is correct (I expect to see backslashes on Windows ).
To investigate it further you may want to set a breakpoint on line 410 and see what's in target_files
.
Windows can recognize either slash in a path. Running through the debugger, target_files becomes an empty list by the time the program hits line 357 in torrent.py
Check whether file is empty. Empty files are skipped.
That'd be it. What's the move for not having it crash the whole program on an empty file? A try/except?
We probably need to handle IndexError on line 410.
There're two ways:
TorrentError
with a more user friendly description, like "Unable to create a torrent for empty file."The 2nd seems to me more appropriate. If so, yes, try/except
is to be used.
Since 1.1.0 TorrentError
is raised with a more proper description.
Considered closed. Feel free to reopen if required.
using the line myTorrent = Torrent.create_from(activeFile) with activeFile = C:/Users/user/Desktop/test/file2.txt returns:
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\torrentool\torrent.py", line 410, in create_from info['length'] = target_files[0][1] IndexError: list index out of range