From: Steve C. <ste...@ya...> - 2004-11-09 09:31:15
|
On Tue, 2004-11-09 at 12:24, mat...@li... wrote: > Hi, > > I keep getting this error when my matplotlib gtk app starts up: > > Could not load matplotlib icon: Couldn't recognize the image file > format > for file 'C:\Python23\share\matplotlib\matplotlib.svg' > > I don't *think* it's my fault. It doesn't seem to do any harm but it's > untidy all the same. > > Any suggestions? > > Cheers, > Matthew. It looks like the problem is happening because your version of GTK does include a GDK pixbuf loader for SVG files. You can disable the message by editing the installed backend_gtk.py (or editing the source file matplotlib\lib\matplotlib\backends\backend_gtk.py and reinstalling) and changing "verbose.report_error('Could not load matplotlib icon: %s' % sys.exc_info()[1])" to "verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])" or just "pass". The fix has also been applied to CVS. Steve |
From: John H. <jdh...@ac...> - 2004-11-09 15:03:04
|
Steve> I changed the code in cvs to import pygtk if not hasattr(sys, 'frozen'): pygtk.require('2.0') Steve> I think that should fix it. Perhaps it would be better to define a constant in matplotlib.__init__.py, something like matplotlib.PY2EXE = hasattr(sys, 'frozen') because then the code which is conditional upon py2exe would be more readable if not matplotlib.PY2EXE pygtk.require('2.0') or something like that... JDH |
From: Chris B. <Chr...@no...> - 2004-11-09 18:03:54
|
John Hunter wrote: > Perhaps it would be better to define a constant in > matplotlib.__init__.py, something like > > matplotlib.PY2EXE = hasattr(sys, 'frozen') > > because then the code which is conditional upon py2exe would be more > readable > > if not matplotlib.PY2EXE > pygtk.require('2.0') > > or something like that... Except that Py2EXE is not the only method of "freezing" apps. In particular, you'd want this to work with OS-X's Py2App, and probably other methods of bundling apps. you might want: matplotlib.FROZEN = hasattr(sys, 'frozen') and if not matplotlib.FROZEN pygtk.require('2.0') Then you could also accommodate other keywords that other bundling methods use. BTW, is someone really successfully using PyGTK on Windows? Cool! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: John H. <jdh...@ac...> - 2004-11-09 18:53:32
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: Chris> BTW, is someone really successfully using PyGTK on Windows? Chris> Cool! I've deployed pretty complex pygtk apps on windows, that incorporate matplotlib and VTK. Works great - my windows user have never complained. Of course I had to write the vtk gtkglext render window myself.... Really, though, I've been extremely happy with gtk on windows - more so than on OSX, actually. JDH |
From: Al S. <a.d...@wo...> - 2004-11-09 19:14:06
|
Hi John, I just installed 0.64 apparently successfully. However, none of the examples run because POLAR cannot be imported. I always get something like this: [ads@ADS1 examples]$ python logo.py Traceback (most recent call last): File "logo.py", line 3, in ? from matplotlib.matlab import * File "/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py", line 162, in ? from axes import Axes, PolarAxes File "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", line 9, in ? from artist import Artist File "/usr/local/lib/python2.3/site-packages/matplotlib/artist.py", line 4, in ? from transforms import identity_transform File "/usr/local/lib/python2.3/site-packages/matplotlib/transforms.py", line 189, in ? from _transforms import IDENTITY, LOG10, POLAR, Func, FuncXY ImportError: cannot import name POLAR I'm on Redhat linux 9 and have installed every version of matplotlib since 0.50. What gives? Thanks. -Al |
From: John H. <jdh...@ac...> - 2004-11-09 19:29:58
|
>>>>> "Al" == Al Schapira <a.d...@wo...> writes: Al> Hi John, I just installed 0.64 apparently Al> successfully. However, none of the examples run because POLAR Al> cannot be imported. I always get something like this: Al> [ads@ADS1 examples]$ python logo.py Traceback (most recent Al> call last): File "logo.py", line 3, in ? from Al> matplotlib.matlab import * File Al> "/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py", Al> line 162, in ? from axes import Axes, PolarAxes File Al> "/usr/local/lib/python2.3/site-packages/matplotlib/axes.py", Al> line 9, in ? from artist import Artist File Al> "/usr/local/lib/python2.3/site-packages/matplotlib/artist.py", Al> line 4, in ? from transforms import identity_transform File Al> "/usr/local/lib/python2.3/site-packages/matplotlib/transforms.py", Al> line 189, in ? from _transforms import IDENTITY, LOG10, Al> POLAR, Func, FuncXY ImportError: cannot import name POLAR Please see my previous post with subject "if you have troubles installing" |
From: Steve C. <ste...@ya...> - 2004-11-10 08:19:25
|
On Wed, 2004-11-10 at 12:16, mat...@li... wrote: > John Hunter wrote: > > Perhaps it would be better to define a constant in > > matplotlib.__init__.py, something like > > > > matplotlib.PY2EXE = hasattr(sys, 'frozen') > > > > because then the code which is conditional upon py2exe would be more > > readable > > > > if not matplotlib.PY2EXE > > pygtk.require('2.0') > > > > or something like that... > > Except that Py2EXE is not the only method of "freezing" apps. In > particular, you'd want this to work with OS-X's Py2App, and probably > other methods of bundling apps. > > you might want: > > matplotlib.FROZEN = hasattr(sys, 'frozen') > > and > > if not matplotlib.FROZEN > pygtk.require('2.0') > > Then you could also accommodate other keywords that other bundling > methods use. > > BTW, is someone really successfully using PyGTK on Windows? Cool! > > -Chris I added matplotlib.FROZEN to matplotlib.__init__.py. It did not work because matplotlib has not yet been imported when pygtk.require() is called. So I changed the import order and it seems to be working on now. Steve |
From: Steve C. <ste...@ya...> - 2004-11-10 13:08:56
|
On Tue, 2004-11-09 at 12:24, matthew arnison wrote: > 2. I was getting errors that the > matplotlib.backends.backend_mod.IMAGE_FORMAT attribute was not > found, during toolbar initialization. I put in a workaround. Is this happening when using the classes directly rather than using the matlab interface? Are you doing something similar to the example "embedding_in_gtk2.py" - that works OK for me. Could you provide a minimal example to demonstrate this. Steve |
From: matthew a. <ma...@ca...> - 2004-11-16 01:02:18
|
Well it works now. For other reasons I downgraded to 0.63 and upgraded again to 0.64. As part of this I found I had to manually wipe not only Python23/Lib/site-packagaes/matplotlib but also Python23/share/matplotlib to avoid errors (e.g. an ImportError: cannot import artist from Artist). But now I don't need that workaround to avoid the IMAGE_FORMAT error. examples/embedding_in_gtk2.py works fine too, after patching in the toolbar = NavigationToolbar(canvas, win) API change. I'm sorry for the confusion. Cheers, Matthew. On Wed, 10 Nov 2004, Steve Chaplin wrote: > On Tue, 2004-11-09 at 12:24, matthew arnison wrote: > > 2. I was getting errors that the > > matplotlib.backends.backend_mod.IMAGE_FORMAT attribute was not > > found, during toolbar initialization. I put in a workaround. > > Is this happening when using the classes directly rather than using the > matlab interface? Are you doing something similar to the example > "embedding_in_gtk2.py" - that works OK for me. > Could you provide a minimal example to demonstrate this. > > Steve |
From: matthew a. <ma...@ca...> - 2004-11-09 12:14:22
|
Thanks heaps. That made things quiet once more. While I was in there I noticed the stanza at the top which includes: import pygtk pygtk.require('2.0') Can I suggest wrapping this with a check for py2exe? Like so: if not hasattr(sys, 'frozen'): import pygtk pygtk.require('2.0') This is because pygtk.require does not work with py2exe. I guess this really a bug in pygtk. But since it is a show stopper at deployment time (as I discovered), I suggest it is important enough to provide this work around in matplotlib. Cheers, Matthew. Steve Chaplin wrote: > On Tue, 2004-11-09 at 12:24, > mat...@li... wrote: > >>Hi, >> >>I keep getting this error when my matplotlib gtk app starts up: >> >>Could not load matplotlib icon: Couldn't recognize the image file >>format >>for file 'C:\Python23\share\matplotlib\matplotlib.svg' >> >>I don't *think* it's my fault. It doesn't seem to do any harm but it's >>untidy all the same. >> >>Any suggestions? >> >>Cheers, >>Matthew. > > > It looks like the problem is happening because your version of GTK does > include a GDK pixbuf loader for SVG files. > > You can disable the message by editing the installed backend_gtk.py > (or editing the source file > matplotlib\lib\matplotlib\backends\backend_gtk.py > and reinstalling) > and changing > "verbose.report_error('Could not load matplotlib icon: %s' % > sys.exc_info()[1])" > to > "verbose.report('Could not load matplotlib icon: %s' % > sys.exc_info()[1])" > or just "pass". > > The fix has also been applied to CVS. > > Steve > |
From: Steve C. <ste...@ya...> - 2004-11-09 14:51:59
|
On Tue, 2004-11-09 at 20:14, matthew arnison wrote: > Thanks heaps. That made things quiet once more. > > While I was in there I noticed the stanza at the top which includes: > > import pygtk > pygtk.require('2.0') > > Can I suggest wrapping this with a check for py2exe? Like so: > > if not hasattr(sys, 'frozen'): > import pygtk > pygtk.require('2.0') > > This is because pygtk.require does not work with py2exe. I changed the code in cvs to import pygtk if not hasattr(sys, 'frozen'): pygtk.require('2.0') I think that should fix it. Steve |