Closed anthonywu closed 10 years ago
display = Display() # ... truncated stacktrace ... /lib/python2.7/site-packages/easyprocess/__init__.pyc in __repr__(self) 135 msg = '<%s cmd_param=%s alias={alias} cmd=%s ({scmd}) oserror=%s returncode=%s stdout="%s" stderr="%s" timeout=%s>' % ( 136 self.__class__.__name__, --> 137 self.cmd_param, 138 self.cmd, 139 self.oserror, AttributeError: Display instance has no attribute 'cmd_param'
AbstractDisplay, being an instance of EasyProcess, does not define EasyProcess.cmd_param until EasyProcess. __init__ is invoked
AbstractDisplay
EasyProcess
EasyProcess.cmd_param
EasyProcess. __init__
I understand why you do not want to call EasyProcess. __init__ until AbstractDisplay.start(), but that leaves this edge case.
AbstractDisplay.start()
AbstractDisplay.__init__
cmd_param
AbstractDisplay.__repr__
start()
import contextlib import pyvirtualdisplay @contextlib.contextmanager def virtual_display(*display_pargs, **display_kwargs): display = pyvirtualdisplay.Display(*display_pargs, **display_kwargs) display.start() yield display.stop()
Thanks for the bug report!
You bet. Appreciate the fix!
Reproduce
Cause:
AbstractDisplay
, being an instance ofEasyProcess
, does not defineEasyProcess.cmd_param
untilEasyProcess. __init__
is invokedI understand why you do not want to call
EasyProcess. __init__
untilAbstractDisplay.start()
, but that leaves this edge case.Proposed solutions
AbstractDisplay.__init__
, set a dummycmd_param
attributeAbstractDisplay.__repr__
and handle the case wherestart()
has not been invoked