[ome-devel] Scripts / Environment Variables / OpenGL...

Jerome Avondo jeromeavondo at msn.com
Thu Jan 27 12:07:03 GMT 2011


Cheers Josh,

FYI as another work around I just set the environment variables in the script...

from os import environ
import numpy

        envarg = environ.copy()
        envarg["DISPLAY"] = ":0.0"
        cmd = 'glxinfo'
        run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=envarg)

Thanks,

J.

> Subject: Re: [ome-devel] Scripts / Environment Variables / OpenGL...
> From: josh at glencoesoftware.com
> Date: Wed, 26 Jan 2011 19:15:26 +0100
> CC: ome-devel at lists.openmicroscopy.org.uk
> To: jeromeavondo at msn.com
> 
> Hi Jerome,
> 
> The entire environment from the running user is not copied into the subprocess. If you would like to workaround for the moment see:
> https://trac.openmicroscopy.org.uk/omero/browser/ome.git/components/tools/OmeroPy/src/omero/processor.py#L127
> We can discuss the implementation under:
> http://trac.openmicroscopy.org.uk/omero/ticket/4027
> 
> Cheers,
> ~Josh
> 
> 
> On Jan 26, 2011, at 6:46 PM, Jerome Avondo wrote:
> 
> > 
> > Hi all,
> > 
> > I have the following problem,
> > 
> > I have OMERO 4.2.1 installed on a linux box, fedora core 12.
> > I have a user called omero on the box, who starts/runs omero,
> > The user omero also has the ~/.bashrc file setup to contain,
> > 
> > export DISPLAY =:0.0
> > 
> > such that I can have access to the xserver for stuff like OpenGL applications. 
> > So when I'm logged in as omero, I can run glxinfo etc etc ... 
> > All works fine from terminal...
> > 
> > But when I try to run a server side script from OMERO.insight, and do something simple like (note some code removed for simplicity sake):
> > 
> > import subprocess
> > 
> > def doSomething():
> > 
> >        cmd = "glxinfo"
> >        run = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> > 
> >        returncode = run.wait()
> > 
> >        stdout = run.stdout.readlines()
> >        stderr = run.stderr.readlines()        
> >        log("stdout: %s stderr: %s" % (stdout,stderr) )
> > 
> > I get an error back saying "Error: unable to open display". Which would lead me to believe that the DISPLAY environment variable is not specified no?
> > The omero python scripts should be executed as the omero user no? So how come the DISPLAY variables seems to have gotten lost?
> > 
> > Any help appreciated as useal...
> > Thanks,
> > 
> > Jerome.
> > 
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20110127/5b53316e/attachment.html>


More information about the ome-devel mailing list