From 51c68c27c00733910d5b27a90db8d47d75f80b5f Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sat, 17 Sep 2022 21:34:43 -0700 Subject: [PATCH] add useful debug info when a file cannot be found.. --- ui/medashare/btv/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/medashare/btv/__init__.py b/ui/medashare/btv/__init__.py index a92f748..5f878a3 100644 --- a/ui/medashare/btv/__init__.py +++ b/ui/medashare/btv/__init__.py @@ -156,15 +156,17 @@ def validate_file(fname, with_file_hashes=None): finddname = glob_escape(torrent['info']['name'].decode(_encoding)) + missingfname = None for dirname in fname.parent.rglob(finddname): tordir = dirname.parent try: return validate(torrent, tordir, with_file_hashes) except FileNotFoundError as e: + missingfname = e.filename continue else: - raise FileNotFoundError('unable to find directory for %s' % (repr(fname.name))) + raise FileNotFoundError('unable to find directory for %s%s' % (repr(fname.name), (', missing file %s' % repr(missingfname)) if missingfname else '')) def validate(torrent, basedir, with_file_hashes=None): '''Take a decode torrent file, where it was stored in basedir,