On 09-12-14 14:16, devquestio...@gmail.com wrote:
> I am seeing the error "cannot connect to X server" in a stand alone python
> application at
> "app = QgsApplication([], True)".
> 
> As suggested in the mailing archives I tried setting DISPLAY env variable to
> "", but that does not resolve the problem. Would be a great help if you can
> point me any references on the issue or have any suggestions on what i can
> try.
> 
> Os Ubuntu
> 
> code :
> 
> import os
> import sys
> 
> #qgisprefix = '/usr'
> qgisprefix='/usr/share/qgis/resources'
> 
> 
> os.environ['DISPLAY']=""
> from qgis.core import *
> 
> from qgis.gui import *_
> 
> # configure QGIS paths
> QgsApplication.setPrefixPath(qgisprefix, True)
> 
> # initalise QGIS
> QgsApplication.initQgis()
> 
> app = QgsApplication([], True) 

I'm on Debian here, and (given the right PYTHONPATH and LD_LIBRARY path
are correct), your code works for me.

Here:
http://comments.gmane.org/gmane.comp.gis.qgis.devel/34478
Martin tells something about the differences between the inits of qgis.
Setting the DISPLAY to "" as you do is actually setting it to NONE!

If you are in a X-session you should not need to set this. If you are
running it on a headless server, then it is possible you do not have X.

Are you sure ubuntu is actually running X? Wasn't ubuntu busy with
trying to make something else instead of X, mir or so?
Can you try it on another machine?

Regards,

Richard Duivenvoorde

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to