clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
674 stars 176 forks source link

AttributeError: 'NoneType' object has no attribute 'isfile #1821

Closed ikkeenjij36 closed 7 months ago

ikkeenjij36 commented 3 years ago

Describe the bug A clear and concise description of what the bug is. script is exiting with errors therefore not placing or handling files right

Technical Specs

  1. Running on (Windows, Linux, NAS Model etc) '....'synology ds3617xs
  2. Python version '....'3.7
  3. Download Client (NZBget, SABnbzd, Transmission) '....'sabnzbd
  4. Intended Media Management (SickChill, CouchPotoato, Radarr, Sonarr) '....'headphones

Expected behavior A clear and concise description of what you expected to happen. As given with the log script isn't running as should be Log Please provide an extract, or full debug log that indicates the issue. `[12:06:59] [DEBUG]::MAIN: Options passed into nzbToMedia: ['/volume1/scripts/nzbToMedia/nzbToMedia.py', '/volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3', 'Anouk - Anouk - Hotel New York (2004) MP3.nzb', 'Anouk - Anouk - Hotel New York (2004) MP3', '', 'muziek', 'alt.binaries.mp3', '0', ''] [12:06:59] [INFO]::MAIN: Script triggered from SABnzbd Version 3.1.1. [12:06:59] [DEBUG]::MAIN: Adding NZB download info for directory /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3 to database [12:06:59] [INFO]::MAIN: Auto-detected SECTION:HeadPhones [12:06:59] [DEBUG]::MAIN: Checking for archives to extract in directory: /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3 [12:06:59] [INFO]::MAIN: Calling HeadPhones:muziek to post-process:Anouk - Anouk - Hotel New York (2004) MP3 [12:06:59] [DEBUG]::SERVER: Attempting to connect to server at http://localhost:8182/api [12:07:10] [DEBUG]::SERVER: Server responded at http://localhost:8182/api [12:07:10] [WARNING]::EXCEPTION: No name replacement determined for uni [12:07:10] [DEBUG]::EXCEPTION: Replacing file name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Anouk - Hotel New York/uni.jpg with download name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Anouk - Hotel New York/Anouk - Anouk - Hotel New York (2004) MP3.jpg [12:07:10] [WARNING]::EXCEPTION: No name replacement determined for uni [12:07:10] [DEBUG]::EXCEPTION: Replacing file name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Bon Jovi - Slippery When Wet/uni.jpg with download name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Bon Jovi - Slippery When Wet/Anouk - Anouk - Hotel New York (2004) MP3.jpg [12:07:10] [WARNING]::EXCEPTION: No name replacement determined for uni [12:07:10] [DEBUG]::EXCEPTION: Replacing file name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Dire Straits-Money For Nothing/uni.jpg with download name /volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3/Dire Straits-Money For Nothing/Anouk - Anouk - Hotel New York (2004) MP3.jpg [12:07:10] [DEBUG]::MAIN: Attempting to get current status for release:Anouk - Anouk - Hotel New York (2004) MP3 [12:07:10] [DEBUG]::MAIN: Opening URL: http://localhost:8182/api with PARAMS: {'apikey': 'b3d16df1a9ae5b916996ba60c2b67b5a', 'cmd': 'getHistory'} [12:07:10] [DEBUG]::HEADPHONES: Opening URL: http://localhost:8182/api with PARAMS: {'apikey': 'b3d16df1a9ae5b916996ba60c2b67b5a', 'cmd': 'forceProcess', 'dir': '/volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3'} Changing to directory: /volume1/scripts/nzbToMedia

-- Cleaning bytecode -- b'Removing pycache/\n' b'Removing pycache/\n'

-- Cleaning folders: ['libs', 'core'] -- No folders to clean

Returning to directory: /volume1/@appstore/sabnzbd/share/SABnzbd

-- Cleanup finished --

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 384, in _make_request six.raise_from(e, None) File "", line 2, in raise_from File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 380, in _make_request httplib_response = conn.getresponse() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 1344, in getresponse response.begin() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 306, in begin version, status, reason = self._read_status() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 267, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/var/packages/python3/target/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/libs/common/requests/adapters.py", line 449, in send timeout=timeout File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/util/retry.py", line 367, in increment raise six.reraise(type(error), error, _stacktrace) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/packages/six.py", line 686, in reraise raise value File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 386, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 306, in _raise_timeout raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=8182): Read timed out. (read timeout=300)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 1061, in exit(main(sys.argv)) File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 968, in main failure_link=os.environ['SAB_FAILURE_URL']) File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 855, in process result = music.process(section_name, input_directory, input_name, status, client_agent, input_category) File "/volume1/scripts/nzbToMedia/core/auto_process/music.py", line 86, in process res = force_process(params, url, apikey, input_name, dir_name, section, wait_for) File "/volume1/scripts/nzbToMedia/core/auto_process/music.py", line 227, in force_process r = requests.get(url, params=params, verify=False, timeout=(30, 300)) File "/volume1/scripts/nzbToMedia/libs/common/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=8182): Read timed out. (read timeout=300) Exception ignored in: <function PosixProcess.del at 0x7f69c2988200> Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/core/utils/processes.py", line 95, in del AttributeError: 'NoneType' object has no attribute 'isfile'`

clinton-hall commented 3 years ago

Are there any logs from HeadPhones at [12:07:10] ? The issue here is that HeadPhones doesn't appear to have acknowledged the api call and therefore the request timed out.

ikkeenjij36 commented 3 years ago

Are there any logs from HeadPhones at [12:07:10] ? The issue here is that HeadPhones doesn't appear to have acknowledged the api call and therefore the request timed out.

here it is07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Parsing results from https://nzbs2go.com/ using search term: P!nk Cant Take Me Home 07-Mar-2021 12:07:10 - ERROR :: CP Server Thread-5 : Request raise HTTP error with status code 404 (local client error). 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : No appropriate matches found for P!nk - Can’t Take Me Home 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Search for wanted albums complete 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Received API command: getHistory 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Received API command: forceProcess 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Force checking download folder for completed downloads 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Found 3 folders to process (0 ignored). 07-Mar-2021 12:07:10 - INFO :: CP Server Thread-5 : Processing: Anouk - Hotel New York 07-Mar-2021 12:07:11 - INFO :: CP Server Thread-5 : Found a match in the database: Anouk - Hotel New York. Verifying to make sure it is the correct alb This is hp Now this is from sabnzbd 2021-03-07 12:07:10,543::INFO::[nzbqueue:231] Saving que

ikkeenjij36 commented 3 years ago

Thsi when i started with hp result from script in sabnzbd Returning to directory: /volume1/@appstore/sabnzbd/share/SABnzbd

-- Cleanup finished --

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 384, in _make_request six.raise_from(e, None) File "", line 2, in raise_from File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 380, in _make_request httplib_response = conn.getresponse() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 1344, in getresponse response.begin() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 306, in begin version, status, reason = self._read_status() File "/var/packages/python3/target/lib/python3.7/http/client.py", line 267, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/var/packages/python3/target/lib/python3.7/socket.py", line 589, in readinto return self._sock.recv_into(b) socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/libs/common/requests/adapters.py", line 449, in send timeout=timeout File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/util/retry.py", line 367, in increment raise six.reraise(type(error), error, _stacktrace) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/packages/six.py", line 686, in reraise raise value File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 386, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "/volume1/scripts/nzbToMedia/libs/common/urllib3/connectionpool.py", line 306, in _raise_timeout raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value) urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=8182): Read timed out. (read timeout=300)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 1061, in exit(main(sys.argv)) File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 968, in main failure_link=os.environ['SAB_FAILURE_URL']) File "/volume1/scripts/nzbToMedia/nzbToMedia.py", line 855, in process result = music.process(section_name, input_directory, input_name, status, client_agent, input_category) File "/volume1/scripts/nzbToMedia/core/auto_process/music.py", line 86, in process res = force_process(params, url, apikey, input_name, dir_name, section, wait_for) File "/volume1/scripts/nzbToMedia/core/auto_process/music.py", line 227, in force_process r = requests.get(url, params=params, verify=False, timeout=(30, 300)) File "/volume1/scripts/nzbToMedia/libs/common/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/volume1/scripts/nzbToMedia/libs/common/requests/adapters.py", line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=8182): Read timed out. (read timeout=300) Exception ignored in: <function PosixProcess.del at 0x7f24aeda9200> Traceback (most recent call last): File "/volume1/scripts/nzbToMedia/core/utils/processes.py", line 95, in del AttributeError: 'NoneType' object has no attribute 'isfile'` I think this is at 12.07.10 After that this what happened while hp was still running `[12:52:23] [INFO]::MAIN: Auto-detected SECTION:HeadPhones [12:52:23] [DEBUG]::MAIN: Checking for archives to extract in directory: /volume1/downloads/complete/muziek/Coldplay - A Head Full Of Dreams (Japan Tour Edition) (2017) FLAC [12:52:23] [INFO]::MAIN: Calling HeadPhones:muziek to post-process:Coldplay - A Head Full Of Dreams (Japan Tour Edition) (2017) FLAC [12:52:23] [DEBUG]::SERVER: Attempting to connect to server at http://localhost:8182/api [12:54:23] [ERROR]::SERVER: Server failed to respond at http://localhost:8182/api [12:54:23] [ERROR]::HEADPHONES: Server did not respond. Exiting [12:54:23] [ERROR]::MAIN: A problem was reported in the /volume1/scripts/nzbToMedia/nzbToMedia.py script. Changing to directory: /volume1/scripts/nzbToMedia

-- Cleaning bytecode -- b'Removing pycache/\n' b'Removing pycache/\n'

-- Cleaning folders: ['libs', 'core'] -- No folders to clean

Returning to directory: /volume1/@appstore/sabnzbd/share/SABnzbd

-- Cleanup finished -- `

clinton-hall commented 3 years ago

That last log shows that HeadPhones isn't responding to api requests:

[12:54:23] [ERROR]::SERVER: Server failed to respond at http://localhost:8182/api
[12:54:23] [ERROR]::HEADPHONES: Server did not respond. Exiting

in the original log, the server did respond, but then after being sent the force process command, it doesn't respond again:

[12:07:10] [DEBUG]::HEADPHONES: Opening URL: http://localhost:8182/api with PARAMS: {'apikey': 'b3d16df1a9ae5b916996ba60c2b67b5a', 'cmd': 'forceProcess', 'dir': '/volume1/downloads/complete/muziek/Anouk - Anouk - Hotel New York (2004) MP3'}

So if HP still running? I note that even the log you provided from HP is truncated: 07-Mar-2021 12:07:11 - INFO :: CP Server Thread-5 : Found a match in the database: Anouk - Hotel New York. Verifying to make sure it is the correct alb Was there anything else afterwards, or did HeadPhones crash while trying to process that album?

ikkeenjij36 commented 3 years ago

Hp did not crash but still not processing the files. In sabzbnd it also states that hp isn't responding.