Closed xyzxye closed 2 months ago
Can you please provide a traceback as shown with -l/--log
set?
[nndownload] 2024-04-25.log:
2024-04-25 15:40:36,013 INFO: Using provided session cookie.
2024-04-25 15:40:36,013 INFO: Session cookie read as string.
2024-04-25 15:41:54,670 INFO: Using provided session cookie.
2024-04-25 15:41:54,670 INFO: Session cookie read as string.
2024-04-25 15:45:00,995 ERROR: An exception was encountered:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
raise err
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 358, in connect
self.sock = conn = self._new_conn()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001F39CE23820>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 815, in urlopen
return self.urlopen(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 815, in urlopen
return self.urlopen(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 815, in urlopen
return self.urlopen(
[Previous line repeated 2 more times]
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.nicovideo.jp', port=443): Max retries exceeded with url: /my (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F39CE23820>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\nndownload\nndownload.py", line 2102, in main
session = login(account_username, account_password, session_cookie)
File "C:\ProgramData\Anaconda3\lib\site-packages\nndownload\nndownload.py", line 2003, in login
my_request = session.get(MY_URL)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.nicovideo.jp', port=443): Max retries exceeded with url: /my (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F39CE23820>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))
There will be no issues during normal downloads, this issue only occurs when my own network environment has some problem, but the strange thing is when exceptions like ConnectionError
, ProxyError
or FfmpegDLException
happens, the program ends without a raise exception but Process finished with exit code 0
It will raise an exception normally in previous versions
My current solution is to seize the output content of the console throughprocess = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
, But I don't think this is a good solution XD
This has nothing to do with HLS downloader, it was due to the change in https://github.com/AlexAplin/nndownload/commit/d63901139d81c7450c2da82a41bd9bda1d8439d0#diff-be28d7f1183e814d278c7b65b6a5305ff91be0e1b638ed51a0b4068473fb0b07L1855
where re-raise
was removed upon Exception in main()
.
Was this change intentional, @AlexAplin ?
Honestly it might have been at the time, the exception handling has changed quite a bit to make logging more useful. I don't see why it shouldn't be added back now though.
@xyzxye Which version was it that you tested it behaving as expected?
I think re-raise there even with today's code does no harm, since it's for the outermost layer of main(), which means if there is any exception there, nndownload is going to exit entirely anyway (there is another layer for cli() but it's only for KeyboardInterrupt
, so not relevant here).
So the only difference would be exiting with code 1 instead of 0 which is what we have currently.
version=1.12.2 can work normally
@xyzxye Okay, that makes more sense knowing how old it was. 🙂 Thanks!
although the latest HLS downloader can function normally, I find that Exceptions like
ConnectionError
,ProxyError
andFfmpegDLException
can't be raise as Exceptions but print as logs...This will not have any issues during a single download, but these Exceptions cannot be captured when running nndownload multiple times for continuous downloads.
These problems are caused by my own unstable network connection, I used to write a scrpit
that would reset my network environment if I encountered any exception (
Exception:***\n Process finished with exit code 1
) while executing nndownload multiple times for continuous downloads. But those Exception won't be raised now (failed to download butProcess finished with exit code 0
)