View Full Version : [pyhton] Screenshop to be displayed online

March 31st, 2011, 09:30 PM

Im trying to create a web-app that will allow me to view snapshots of my desktop from a remote location. For example i could go to http://MyComp/screen.php and it would display the site. Id like to use the tag <img src="./screen.py" />. I do have python enabled on the web server. I just need a way for me to access the current x screen and get an image from it.

After a bit of playing around i have this all setup...

def run(*args):
import os
os.system("import -window root -display :0.0 screen.png")
return file("screen.png")

Running that i get this in my /var/log/apache2/error.log
import: unable to open X server `:0.0' @ error/import.c/ImportImageCommand/362.

However, if i run that line in my ssh connection window. It runs fine...


April 1st, 2011, 09:03 PM
I have also tried adding in localhost:0, localhost:0.0 and just :0 all return errors. Could it be that user www-data does not have access to the x display?


November 2nd, 2011, 02:26 AM
Having this same problem. Did you ever get it figured out?

November 2nd, 2011, 02:28 AM
Never mind. Figured out that I have to export HOME to make it work. :)

HOME=/home/blah export HOME