Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x.interact() should print an error message when no canvas is open #862

Closed
jypeter opened this issue Oct 31, 2014 · 1 comment
Closed

x.interact() should print an error message when no canvas is open #862

jypeter opened this issue Oct 31, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@jypeter
Copy link
Member

jypeter commented Oct 31, 2014

If I call x.interact() when the vcs canvas is not open, either because I have not plotted anything yet (e.g. the canvas has never been opened) or because, I have closed the canvas with x.close(), I get an ugly traceback. It would ne nicer to print a warning message

>>> import vcs
>>> x = vcs.init()
>>> x.interact()
/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/VTKPlots.py:60: UserWarning: Press 'Q' to exit interactive mode and continue script execution
  warnings.warn("Press 'Q' to exit interactive mode and continue script execution")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/Canvas.py", line 470, in interact
    self.backend.interact(*args,**kargs)
  File "/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/VTKPlots.py", line 61, in interact
    interactor = self.renWin.GetInteractor()
AttributeError: 'NoneType' object has no attribute 'GetInteractor'

The error is not exactly the same if I have plotted something with bg=1, but it's the same kind

>>> import vcs, numpy as np
>>> x = vcs.init()
>>> i = np.identity(100)
>>> x.plot(i, bg=1)
<vcs.displayplot.Dp object at 0x2b0b4d0be670>
>>> x.pdf('bgtest')
>>> x.interact()
/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/VTKPlots.py:60: UserWarning: Press 'Q' to exit interactive mode and continue script execution
  warnings.warn("Press 'Q' to exit interactive mode and continue script execution")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/Canvas.py", line 470, in interact
    self.backend.interact(*args,**kargs)
  File "/home/share/unix_files/cdat/versions/cdat_install_uv-2.0.0_x86_64_gcc4_12/lib/python2.7/site-packages/vcs/VTKPlots.py", line 62, in interact
    interactor.Start()
AttributeError: 'NoneType' object has no attribute 'Start'

@doutriaux1 doutriaux1 added the VCS label Oct 31, 2014
@doutriaux1 doutriaux1 added this to the 2.1 milestone Oct 31, 2014
@doutriaux1 doutriaux1 self-assigned this Oct 31, 2014
@doutriaux1
Copy link
Contributor

fixed in issue_862_interact_no_renwin pull requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants