1

I have a python script that does some things online. Every 10 seconds launchd (OSX 10.11.3 El Capitan) launches a shell script, which calls the python script, which goes online using selenium webdriver.PhantomJS() (or should).

When running the shell script from the terminal, everything succeeds. When running in the configuration described above but with webdriver.Firefox() instead of webdriver.PhantomJS(), everything succeeds. However, when running through launchd -> shell -> python with webdriver.PhantomJS(), it exits with abnormal code: 1.

A simplified version of my code (with all the imports):

from selenium import webdriver
import selenium.webdriver.support.ui as ui
from selenium.common.exceptions import  NoSuchElementException
d = webdriver.PhantomJS()
d.close()

What am I missing? I would suspect full path names, but I do not explicitly import Firefox() either, and that does work...

gail
  • 65
  • 7

1 Answers1

0

Is it failing on an import failure? I had a similar-sounding problem, outlined here: Running Python Script with Launchd: imports not found

What was helpful: using LaunchControl, capturing Standard Error, and finding out python could not import a specific package. Not sure if that's your problem, but Standard Error will tell you what abnormal code: 1 actually is.

Community
  • 1
  • 1
wij
  • 1,304
  • 1
  • 8
  • 9