Phillip Phillip - 19 days ago 10
Python Question

PhantomJS was placed in path and can execute in terminal, but PATH error in Python

note: PhantomJS runs in PyCharm environment, but not IDLE

I have successfully used PhantomJS in Python in the past, but I do not know what to do to revert to that set up.

I am receiving this error in Python (2.7.11): selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.

I have tried to 'symlink' phantomjs to the path (usr/local/bin [which is also in the path]), and even manually locate /usr/local/bin to place phantomjs in the bin folder. However, there is still a path error in python.

What am I missing?

Answer

After placing phantomjs in the folder /usr/bin, the application ran successfully. To access the folder directly, open a finder window, click 'Go' menu at top of screen, click 'Go to folder...', enter '/usr/bin'. Note that if on Mac OS El Capitan, there is a default restriction to this folder which can be disabled