try: except: not working

后端 未结 3 2195
青春惊慌失措
青春惊慌失措 2021-02-20 13:48

So I\'m running into a problem where the try: except: mechanism doesn\'t seem to be working correctly in python.

Here are the contents of my two files.

pyte

3条回答
  •  攒了一身酷
    2021-02-20 14:20

    ... at a guess, you have a namespace problem which is producing a different exception.

    Try replacing

    except:
        print 'Why caught here?'
    

    with

    except Exception, e:
        print e
    

    This may tell you more about what went wrong.

提交回复
热议问题