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

Print a helpful warning when using x.plot and DISPLAY is not set #211

Closed
jypeter opened this Issue Jul 7, 2017 · 10 comments

Comments

Projects
None yet
3 participants
@jypeter

jypeter commented Jul 7, 2017

@charlesdoutriaux It's quite hard (the first time you get the error) to understand what is happening, when you use x.plot and there is no DISPLAY. Especially since it completely crashes python!

bash-4.1$ echo $DISPLAY
localhost:10.0
bash-4.1$ unset DISPLAY
bash-4.1$ echo $DISPLAY

bash-4.1$ source activate cdatm14
(cdatm14) bash-4.1$ python
Python 2.7.12 | packaged by conda-forge | (default, Feb  9 2017, 14:36:30)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import vcs, numpy as np
>>> x = vcs.init()
>>> i = np.identity(10)
>>> x.plot(i)
ERROR: In /export/doutriaux1/anaconda2/conda-bld/vtk-cdat_1479230506328/work/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 1475
vtkXOpenGLRenderWindow (0x223c960): bad X server connection. DISPLAY=Aborted (core dumped)
(cdatm14) bash-4.1$

Can you print an error message and make this more user friendly? Maybe this has already been addressed in 2.10, but I'm still running 2.8

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Jul 7, 2017

hum...

doutriaux1@crunchy:[~]:[16539]> xeyes
Error: Can't open display: 

I think it's really an X11 issue.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Jul 7, 2017

doutriaux1@crunchy:[~]:[16493]> glxgears 
Error: couldn't open display (null)
@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Jul 7, 2017

@danlipsa what do you think? I feel VTK's error is better than most other software in that matter.

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Jul 7, 2017

@doutriaux1 @jypeter We should try not to crash and we probably can make it more clear that DISPLAY is an environment variable that the user should set (or should set properly).
But I agree that the other programs you tried are less helpful in pointing one in the right direction for fixing the problem. Although in the day of google, any error message would be helpful as long as you can find someone who dealt with it on the internet.

@jypeter

This comment has been minimized.

jypeter commented Jul 7, 2017

Well, it said bad X server connection and not the usual variation of Can't open display. I regularly have problems using vcs in virtual machines and X servers, that's why I did not think at first that it was just a problem of DISPLAY not being defined

But we want to be nice and helpful to the end users, don't we? That's why, when you call "x.plot" (or x.png, x.pdf, etc...) it would be nice to print an error message saying it can't be done (and maybe give some hints) rather than something looking like a VTK internal error

Besides, I got a core dumped, which did not help me determine what was going on

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Jul 7, 2017

@jypeter Indeed, we should not crash. We could print a better error by intercepting the VTK message and printing our own.

@jypeter

This comment has been minimized.

jypeter commented Jul 10, 2017

👍

@doutriaux1 doutriaux1 self-assigned this Sep 5, 2017

@doutriaux1 doutriaux1 added this to the 3.0 milestone Sep 5, 2017

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Dec 11, 2017

In [1]: import vcs
Allow anonymous logging usage to help improve UV-CDAT(you can also set the environment variable UVCDAT_ANONYMOUS_LOG to yes or no)? [yes]/no: no

In [2]: x=vcs.init()

In [3]: x.plot([1,2,3,4,3,2,1])
ERROR: In /export/doutriaux1/miniconda2/conda-bld/vtk-cdat_1503063744037/work/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 1475
vtkXOpenGLRenderWindow (0x347f3b0): bad X server connection. DISPLAY=Aborted (core dumped)
(2.12) doutriaux1@drdoom:[~]:[10100]> 
@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Dec 11, 2017

@danlipsa is there a way to know if vtk was compiled against mesalib?

doutriaux1 added a commit that referenced this issue Dec 11, 2017

@jypeter

This comment has been minimized.

jypeter commented Jun 26, 2018

@doutriaux1 FYI have just tried this script in cdat 8.0 on a remote server, after my X server had crashed (so DISPLAY is set, but no working X server), and I got a similar error

>>> x.plot(id10)
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
ERROR: In /export/doutriaux1/miniconda2/conda-bld/vtk-cdat_1525720116131/work/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx, line 333
vtkXOpenGLRenderWindow (0x2ac80b0): bad X server connection. DISPLAY=localhost:23.0. Aborting.


Aborted

Well, I'm not sure you can do something about this (i.e. displaying an error message rather than crashing python)...

I have also cleared the DISPLAY variable, and in that cas I indeed get your error message and stay in python

RuntimeError: No DISPLAY set. Set your DISPLAY env variable or install mesalib conda package
>>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment