Invalid literal for int()
Firstly, thank you for this library. It's seriously impressive and so useful!
I ran into an exception when working with the is_running
function:
File "quip.py", line 40, in main
if is_running('update'):
File "/Users/orf/PycharmProjects/alfred-quip-workflow/workflow/background.py", line 99, in is_running
pid = int(file_obj.read().strip())
ValueError: invalid literal for int() with base 10: ''
The code is taken from the getting started guide and isn't doing anything crazy:
if not wf.cached_data_fresh('documents', max_age=60 * 60 * 60):
cmd = ['/usr/bin/python', wf.workflowfile('quip-update.py')]
run_in_background('update', cmd)
if is_running('update'):
wf.add_item('Getting new posts from Pinboard',
valid=False,
icon=ICON_INFO)
I haven't dug into it, but it seems to me like it's a race condition where the file is created by the new process but the pid has not been written to it yet.
Using something like the pidfile
library solves a lot of these issue, could you vendor it inside this library?