Python Forum
During handling of the above exception, another exception occurred
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
During handling of the above exception, another exception occurred
#2
This is why you declare which exceptions you are trying to catch explicitly, so that other exceptions can propagate as normal:

try:
    names=sorted(listdir(path))
except NotADirectoryError:
    names=[]
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: During handling of the above exception, another exception occurred - by ichabod801 - Dec-20-2018, 09:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  custom exception dcr 1 278 Feb-17-2024, 08:19 PM
Last Post: Gribouillis
  an uncatchable asyncio exception from in 3.12.2 but not 3.11.5 wangli 0 252 Feb-17-2024, 04:10 AM
Last Post: wangli
  use of shutil.copytree with ENOTDIR exception yan 2 919 Nov-29-2023, 03:02 PM
Last Post: yan
  Why am I getting this TypeError Exception? Affinity 8 975 Jul-07-2023, 08:26 AM
Last Post: DeaD_EyE
  which exception should be thrown for a sequence of the wrong length? Skaperen 1 853 Jan-06-2023, 04:13 AM
Last Post: deanhystad
Question log.exception() without arguments in old Python versions? cthart 5 1,178 Nov-19-2022, 07:09 PM
Last Post: Gribouillis
  how to write exception error into logger mg24 3 992 Nov-15-2022, 04:20 PM
Last Post: insharazzak
Star python exception handling handling .... with traceback mg24 3 1,289 Nov-09-2022, 07:29 PM
Last Post: Gribouillis
  create my exception to my function korenron 2 801 Nov-09-2022, 01:50 PM
Last Post: korenron
  'dict()' Has an Exception? htran3 2 755 Nov-04-2022, 08:29 AM
Last Post: htran3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020