John Kitchin wrote:
> I am trying to use matplotlib to generate some figures non-interactively
> via cron, but I can not seem to get matplotlib.figure to import without
> a gtk error, even when I specify to use an image backend. The problem
> seems to be related to trying to import gtk when no X server is present.
> The script runs fine when i am logged in locally, and when logged in
> remotetely with X11 forwarding, but it fails when run through cron or
> when logged in remotely with no X-server. It also does not help if I run
> the script as: python script -dAgg
> 
> I am running matplotlib 0.91.1. Any hints on how to make this work? Am I
> missing something here?

John,

No, you have tripped over a bug that was fixed in the latest release, 
announced earlier this week.  The problem was that for a brief period, 
including the 0.91.1 release, mlab.py included some gtk gui code.  Now 
this has been moved out of the way to another module, so gtk won't be 
imported by accident.

If you can replace your mpl with 0.91.2, that will solve your problem.

Eric


> 
> Thanks!
> 
> j
> 
> Here is an example (minimal) script that causes the error:
> 
> #start script
> import matplotlib
> matplotlib.use('Agg')
> 
> import matplotlib.figure
> #end script
> 
> Output=
> Traceback (most recent call last):
>   File "nox_test.py", line 5, in ?
>     import matplotlib.figure
>   File
> "/home/jkitchin/lib/python2.4/site-packages/matplotlib/figure.py", line
> 10, in ?
>     from axes import Axes, Subplot, PolarSubplot, PolarAxes
>   File "/home/jkitchin/lib/python2.4/site-packages/matplotlib/axes.py",
> line 13, in ?
>     from matplotlib import axis as maxis
>   File "/home/jkitchin/lib/python2.4/site-packages/matplotlib/axis.py",
> line 14, in ?
>     from patches import bbox_artist
>   File
> "/home/jkitchin/lib/python2.4/site-packages/matplotlib/patches.py", line
> 12, in ?
>     import matplotlib.mlab as mlab
>   File "/home/jkitchin/lib/python2.4/site-packages/matplotlib/mlab.py",
> line 2481, in ?
>     class SortedStringsScrolledWindow(gtk.ScrolledWindow):
> NameError: name 'gtk' is not defined
> 
> 


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to