I want to develop a PyQGIS standalone script only using Ubuntu terminal, so to start I use:

from qgis.core import *
QgsApplication.setPrefixPath("/path/to/qgis/installation", True)
qgs = QgsApplication([], False)

But it gives me the next error:

qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

I understand that the error is due cause I'm not using a graphic device (I'm working through Ubuntu's terminal and I can't use a graphic device), but the second argument on QgsApplication() disables the GUI so I thought a graphic device wouldn't be necessary.

What does that error mean? Does it have any solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.