Debugging the Twitterbot

In my earlier post, I explained how I set up a launchd job to run my Twitterbot script, but when 10:30 came around, the job didn’t seem to have worked. I calmly opened LaunchControl and saw that it was reporting an error for the job. But a quick look at the error log revealed the problem:

Traceback (most recent call last):
  File "/Users/wcm1/programming/ricedh/adbot/adbot.py", line 17, in 
    new_ads = os.listdir(new_ads_path)
OSError: [Errno 2] No such file or directory: 'new/'
Traceback (most recent call last):
  File "/Users/wcm1/programming/ricedh/adbot/adbot.py", line 52, in 
    l = open(log_file, 'a')
IOError: [Errno 13] Permission denied: 'twitter.log'

My Twitterbot script had been using some relative paths to directories because I typically ran the script from within the directory containing all the ads. To fix it, I just had to change the paths to absolute paths. Then, I loaded the launchd job again, and …

Eureka! It works!