title: Running phantomjs on linux using python
body: <p>I followed <a href="https://stackoverflow.com/questions/8778513/how-can-i-setup-run-phantomjs-on-ubuntu">this link</a> and now when I type <code>phan</code> and then tab (<code>\t</code>) it does autocomplete to phantomJS.</p>
  
  <p>Yet if I run <code>phantomJS -v</code> or <code>phantomJS --version</code> I get:</p>
  
  <pre><code>bash: /usr/local/bin/phantomjs: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
  </code></pre>
  
  <p>Additionally if I try to run:</p>
  
  <pre><code>&gt;&gt;&gt; from selenium import webdriver
  &gt;&gt;&gt; driver = webdriver.PhantomJS()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 50, in __init__
      service_args=service_args, log_path=service_log_path)
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/service.py", line 50, in __init__
      service.Service.__init__(self, executable_path, port=port, log_file=open(log_path, 'w'))
  IOError: [Errno 13] Permission denied: 'ghostdriver.log'
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>If I try to follow <a href="https://stackoverflow.com/questions/17048594/how-to-disable-or-change-the-path-of-ghostdriver-log">this I get</a>:</p>
  
  <pre><code>&gt;&gt;&gt; import os
  &gt;&gt;&gt; driver = webdriver.PhantomJS(service_log_path=os.path.devnull)
  Exception AttributeError: "'Service' object has no attribute 'log_file'" in &lt;bound method Service.__del__ of &lt;selenium.webdriver.phantomjs.service.Service object at 0x7f182ec13690&gt;&gt; ignored
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
      self.service.start()
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
      os.path.basename(self.path), self.start_error_message)
  selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH. 
  
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Is my selenium/phatnomjs installed with the proper rights?</p>
  
  <p>I created a directory <code>/home/ec2-user/temp</code> and set:</p>
  
  <pre><code>chmod 777 /home/ec2-user/temp
  </code></pre>
  
  <p>Yet </p>
  
  <pre><code>&gt;&gt;&gt; from selenium import webdriver
  &gt;&gt;&gt; driver = webdriver.PhantomJS(service_log_path='/home/ec2-user/temp/ghostdriver.log')
  </code></pre>
  
  <p>Yields:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
      self.service.start()
    File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
      os.path.basename(self.path), self.start_error_message)
  selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH. 
  </code></pre>
  
  <p>If I type <code>which phantomjs</code> I get:</p>
  
  <pre><code>$ which phantomjs
  /usr/local/bin/phantomjs
  </code></pre>