title: PHP exec python not working
body: <p>hey yall.  Im running python on a webserver from dreamhost.  I am using their install of python and am using a lastfm module that can be found here: <a href="http://code.google.com/p/python-lastfm/" rel="nofollow">http://code.google.com/p/python-lastfm/</a></p>
  
  <p>to get it to import properly i do this</p>
  
  <pre><code>import sys
  sys.path.append("/home/myusername/build/Python-2.5/Lib/site-packages/")
  import lastfm
  </code></pre>
  
  <p>since the lastfm module is installed there.  </p>
  
  <p>When I use putty to ssh into my server, i can simply run python test.py and it works perfectly. But when i run it from a php script with</p>
  
  <pre><code>exec("python test.py");
  </code></pre>
  
  <p>it suppossedly does not work and the script doesnt run.  it runs perfectly fine when i do </p>
  
  <pre><code>import lastfm
  </code></pre>
  
  <p>and then have other things after,
  but when i actually try to do something with the module like:</p>
  
  <pre><code>import lastfm
  api=lastfm.Api(api_key)
  </code></pre>
  
  <p>it does not run.  once again i can run the script using the same python install in a shell and it executes fine. So something must be happening that goes wrong when i run it from the php script.  I figured it would be running the exact same python and everything.  I checked other posts and they say it may be something with file permissions, but ive put every file to 777 and it still doesnt work.  idk what the problem could be.  thanks in advance everyone.</p>