Closed Hornswoggles closed 13 years ago
Code is updated: ae5fb6f
I don't understand, why there is no DISPLAY variable. What is your use case?
A base ubuntu install without x-server doesn't have a DISPLAY var set. So after manually installing Xvfb, Xephyr and pyvirtualdisplay I encountered this Key Error.
xephyr=Display(visible=1, size=(320, 240)).start() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/pyvirtualdisplay/abstractdisplay.py", line 65, in start self.old_display_var = os.environ['DISPLAY'] File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__ raise KeyError(key) KeyError: 'DISPLAY'
Easily fixed by adding DISPLAY to the environment with
$: export DISPLAY=':0'
Could handle the exception with a message or needs some logic to handle if DISPLAY doesn't exist. How about: