Eric Emsellem wrote:
> Hi,
> 
> I am trying to run a relatively large code, which includes some calls to and
> import from pylab/matplotlib, on a remote machine: the part of the code I am
> running is NOT performing any plot so there is no direct access to a display.
> Unfortunately it still crashes with something like:
> 
> ---> 40     cursors.MOVE          : gdk.Cursor(gdk.FLEUR),
>      41     cursors.HAND          : gdk.Cursor(gdk.HAND2),
>      42     cursors.POINTER       : gdk.Cursor(gdk.LEFT_PTR),
> 
> RuntimeError: could not create GdkCursor object
> 
> when it tries to reach the display when importing pylab I guess.
> 
> I am now doing this from my laptop from a non-fixed IP and there is no easy 
> way
> for me to forward the display (loging e.g. with ssh -X), or to just isolate 
> the
> pylab part of the code (lots of files, lots of lines, etc).
> 
> I am desperately trying to run this long calculation on that remote machine 
> (and
> do it while my laptop is off, using "screen") because I need a lot of memory 
> and
> CPU.... How can I overpass this easily (just allowing for the code not to 
> crash
> with that initialisation and go on with the rest) ???

Eric,

You need to set a non-interactive backend, typically agg.  The method 
depends on exactly what you are doing and what your constraints are. 
The easiest may be to put a matplotlibrc file in the directory from 
which you are starting your ipython session, or running your script. 
All it needs to contain is the single line:


backend      : Agg


Alternatively, any script can start with

import matplotlib
matplotlib.use('agg')

This has to come before pylab is imported.

Eric

> 
> thanks for any input there
> 
> Eric
> ========
> running: matplotlib version 0.98.3 Python 2.5.1 (r251:54863, Aug  1 2008,
> 00:35:20) via IPython 0.9.1
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to