Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

For completeness, now that I have what I want from the script, but don't quite understand how I broke the exception throwing, here is the original run function from pdftitle.py: def run(): try: ...
dchi2 General Coding Help 11 5,632 Nov-25-2019, 08:47 AM
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

Thank you for your continued assistance. I see now that the whole issue is due to me stupidly editing the module. I commented out a section of the run() function in pdftitle.py as I could not otherw...
dchi2 General Coding Help 11 5,632 Nov-24-2019, 09:40 AM
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

The if statement on line 23 is there because of the uncaught exceptions, I wanted to suppress the exception text and go straight to the else on line 26 import argparse, os, pdftitle, re parser = argp...
dchi2 General Coding Help 11 5,632 Nov-24-2019, 05:23 AM
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

I don't see how there's any difference to what I had in post 1 or 5 aside from the print text, but have done so just in case and still does not catch the exception.
dchi2 General Coding Help 11 5,632 Nov-23-2019, 11:58 PM
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

Sorry that was just a typo, I did enter it as KeyError. This works as expected, only output is "an exception occurred": try: PdfTitle = 1 / 0 except: print("an exception occurred")This does n...
dchi2 General Coding Help 11 5,632 Nov-23-2019, 11:35 PM
    Thread: Handling exception from a module
Post: RE: Handling exception from a module

Sorry, I wasn't clear in my post, I want to catch all exceptions when running that module, which is what I expect an "except:" clause with no exception name to do. I did now try using "except Keyerro...
dchi2 General Coding Help 11 5,632 Nov-23-2019, 10:51 PM
    Thread: Handling exception from a module
Post: Handling exception from a module

Very new to python, grew up on PHP. I'm using the pdftitle module, for its intended purpose, don't seem to be able to gracefully handle it throwing exceptions. Exceptions I've come across are either...
dchi2 General Coding Help 11 5,632 Nov-23-2019, 09:18 AM

User Panel Messages

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