ponty / PyVirtualDisplay

Python wrapper for Xvfb, Xephyr and Xvnc
BSD 2-Clause "Simplified" License
709 stars 78 forks source link

Output from X client is discarded #7

Closed Julian-O closed 12 years ago

Julian-O commented 12 years ago

[I'm looking at Xvfb in particular, but I believe the issues apply across the board.]

Xvfb generates (stderr) output as it runs, which is useful for debugging. PyVirtualDisplay discards this output.

It would be desirable to either:

  1. be able to specify a destination file in XvfbDisplay constructor for stderr.

    or

  2. have the stderr output passed to a logger object, so I can see it/redirect it/suppress it through the standard Python mechanism.
ponty commented 12 years ago

Logging is supported. I added logging to this example: https://github.com/ponty/PyVirtualDisplay/blob/master/pyvirtualdisplay/examples/screenshot3.py

import logging
logging.basicConfig(level=logging.DEBUG)

from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay

with SmartDisplay(visible=0, bgcolor='black') as disp:
    with EasyProcess('xmessage hello'):
        img = disp.waitgrab()

img.show()

Stdout and stderr are logged after closing Xvfb.

Julian-O commented 12 years ago

Oops. Red-faced embarrassment. You answer confused me, until I found in my project's logging set-up some code to suppress debug log messages from easyprocess (!) I did check there for xvfb and pyvirtualdisplay, but didn't realise I should have been looking for easyprocess. Likewise, when examining the code, I didn't realise easyprocess would do this without prompting.

Many apologies. Thank you for your prompt response and very useful project.