Closed victorn closed 2 months ago
Hi Victorn,
By trapping what u mean?
I will close this issue but keep the conversation alive for suggestions
Thank you for your reply. When I wrote “does not trap” I meant that the following instruction i.e. “fs.creat_folder” is not executed even though the error I get is 408.
Could you try to break your exception and try to print something else after that? Just to see if it process it in the right way
Thank you Renato, I believe now, using the Pycharm debugger, that the correct error handling code should be: "if '408' in str(e.error_code):" Thank you for your patience and your tolerance of my mistakes! Problem solved
I am using the Python synology_api on a Windows 10 PC using Python 3.11 I need to trap errors, such as error 408 for instance. Here is my code: QUOTE try: if not fs.get_file_list(season_dir): fs.create_folder(os.path.join(tv_root, get_series_dir(series_name)), f"Season {season_num}") except Exception as e: if '408' in str(e): fs.create_folder(os.path.join(tv_root, get_series_dir(series_name)), f"Season {season_num}") else: raise e UNQUOTE The statement "if '408' in str(e):" does not trap the error, so the program crashes. Any advice on how to trap this (and other) errors? Thank you