Open kchall opened 8 years ago
I just did some poking around, and I wasn't able to find any off-the-shelf solutions to this problem. It does seem feasible to use email, though. I've pasted a basic script that does this below. The big hitch is that the script needs to include log-in credentials, so we'd need to figure out a way to hide those.
import smtplib
fromaddr = "arbitraryaddress@somewhere.com" toaddrs = ["addressthatcollectsbugs@somewhere.com"]
msg = 'test message'
server = smtplib.SMTP('smtp.gmail.com', port=587) server.ehlo() server.starttls() server.ehlo() server.login('yourgmailaccount@somewhere.com', 'yourpassword') server.sendmail(fromaddr, toaddrs, msg) server.quit()
It looks like if we want to be sure that bugs/exceptions are caught in worker threads, we'll need to have subclasses of FunctionWorker
implement a method other than run()
-- perhaps process()
?
run()
can then pseudo-be:
class FunctionWorker:
def run(self):
try:
self.process()
except:
# report the exception
@devyn It looks like the current solution is to have a bunch of checks like this in the Workers which use the emit method to (I assume) pass the Exception on to the main thread:
except PCTError as e:
self.errorEncountered.emit(e)
return
except Exception as e:
e = PCTPythonError(e)
self.errorEncountered.emit(e)
return
Your solution looks like it might be more general, though. Is that right?
re the original issue (getting PCT to report bugs to us):
I just pushed a commit that adds basic bug reporting. It sends traceback and system info as an email from/to the account pctbugs@gmail.com . Right now there are two major elements lacking in the implementation:
Versioning is in __init__.py
of corpustools, so if you do:
import corpustools
print(corpustools.__version__)
That'll spit out '1.1.1' or whatever version we're up to now. It doesn't know master/dev/anything on Github, but that should be fine for most users.
@bhallen Ah, I didn't see that before. But it's definitely not ideal; I'd be willing to bet that there are a few where that error-handling code is either not present or doesn't encompass all of the code. For example, although you wouldn't expect an exception outside of the try block in corpustools.gui.migui.MIWorker
, it might be possible. So it's probably better to come up with something that handles it automatically.
When bugs arise, add an option to actually send us a bug report with information on what went wrong (e-mail? webpage that hosts the reports?).