davidofwatkins / ge-cancellation-checker

A PhantomJS script that checks your GOES account for a sooner Global Entry enrollment appointment
173 stars 74 forks source link

Updated 'phantomjs' path to absolute path #35

Closed PromisedJetpacks closed 7 years ago

PromisedJetpacks commented 7 years ago

Struggled for a while trying to get this to schedule properly. I could run the script fine manually through terminal but when crontab scheduling, it struggled to find phantomjs. Changing the launcher to use the full path '/usr/local/bin/phantomjs' instead of just 'phantomjs' fixed my issue. If you feel this was just my own local mac issue and don't think this commit is necessary, it might be worth at least adding some help documentation on trying to use 'usr/local/bin/phantomjs' instead of 'phantomjs' due to the amount of people attempting to use this that aren't tech-savvy.

davidofwatkins commented 7 years ago

Ah, good catch. However, phantomjs isn't guaranteed to be in /usr/local/bin/ (even though it likely will be). Maybe we can check for both and then error out if we still can't find it:

from distutils.spawn import find_executable

# ...

cmd = find_executable('phantomjs') or find_executable('/usr/local/bin/phantomjs')

if not cmd:
    logging.critical('Cannot find phantomjs. Make sure it is in your path')
    return

script_output = check_output([cmd, '--ssl-protocol=any', '%s/ge-cancellation-checker.phantom.js' % pwd, '--config', settings.get('configfile')]).strip()
PromisedJetpacks commented 7 years ago

Ah, good point. I think what you recommended would definitely help anyone having path issues.

davidofwatkins commented 7 years ago

@PromisedJetpacks Fixed in mater. Thanks!