From d500c61b957491e7d30a0d855f7e1c0c16bb0092 Mon Sep 17 00:00:00 2001 From: andrzejc Date: Sat, 11 Jun 2016 14:22:20 +0200 Subject: [PATCH] TorrentToMedia: fix invalid indexing scope, select first elem of pair not char Fix for issue manifesting itself with the following exception: Traceback (most recent call last): File "/opt/nzbToMedia/TorrentToMedia.py", line 366, in exit(main(sys.argv)) File "/opt/nzbToMedia/TorrentToMedia.py", line 303, in main result = processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, clientAgent) File "/opt/nzbToMedia/TorrentToMedia.py", line 118, in processTorrent outputDestination = os.path.join(core.OUTPUTDIRECTORY, inputCategory, basename) File "/usr/local/lib/python2.7/posixpath.py", line 68, in join if b.startswith('/'): AttributeError: 'tuple' object has no attribute 'startswith' The indexing operator was applied to wrong object: should be selecting first element of tuple returned by splitext() instead of first char of string passed to splitext. --- TorrentToMedia.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index b1a317ae..7b366052 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -114,7 +114,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID, if not os.path.isdir(os.path.join(inputDirectory, inputName)): basename = os.path.basename(inputDirectory) basename = core.sanitizeName(inputName) \ - if inputName == basename else os.path.splitext(core.sanitizeName(inputName)[0]) + if inputName == basename else os.path.splitext(core.sanitizeName(inputName))[0] outputDestination = os.path.join(core.OUTPUTDIRECTORY, inputCategory, basename) elif uniquePath: outputDestination = os.path.normpath(