Trouble with api example code within watermark_image.py

Dear Developers of Matplotlib,

at first thanks for this mightiest tool for graphical output from python data. I have encountered problems on trying the watermark feature as described at http://matplotlib.sourceforge.net/examples/api/watermark_image.html.

When I invoke the script from a Enthought Python Compiler in the Windows COM then I got this message:

Traceback (most recent call last):
   File "Fluide\script1.py", line 13, in <module>
     datafile = cbook.get_sample_data('logo.png', asfileobj=False)
   File "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", line 676, in get_sample_data
     return myserver.get_sample_data(fname, asfileobj=asfileobj)
   File "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", line 623, in get_sample_data
     raise KeyError(msg)
KeyError: 'file iselogo.png not in cache; received <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it> when trying to retrieve'

Does anyone no a solution for this problem? Image is in the same directory as the script. Or if now I switched to it by os.chdir to the specific path.

Thanks in advance for your help.

Kindly regards,
Thore Oltersdorf

matplotlib.cbook documentation :

http://matplotlib.sourceforge.net/api/cbook_api.html?highlight=matplotlib.cbook#matplotlib.cbook.get_sample_data

matplotlib.cbook.``get_sample_data(fname, asfileobj=True
Check the cachedirectory ~/.matplotlib/sample_data for a sample_data file. If it does not exist, fetch it with urllib from the mpl svn repo

http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
and store it in the cachedir.

If asfileobj is True, a file object will be returned. Else the path to the file as a string will be returned

To add a datafile to this directory, you need to check out sample_data from matplotlib svn:

svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data

and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data.

To bypass all downloading, set the rc parameter examples.download to False and examples.directory to the directory where we should look.

So, you have to have the logo.png image in the home/matplotlib/sample_data. If it is not present there, the script will try to download it from the server.

Thomas

ps : emailing 3 times the same question doesn’t make the answer come faster.

···

Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium


Date: Wed, 9 Feb 2011 12:27:21 +0100
From: thore.oltersdorf@…878…3436…
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Trouble with api example code within watermark_image.py

Dear Developers of Matplotlib,

at first thanks for this mightiest tool for graphical output from python
data. I have encountered problems on trying the watermark feature as
described at
http://matplotlib.sourceforge.net/examples/api/watermark_image.html.

When I invoke the script from a Enthought Python Compiler in the Windows
COM then I got this message:

Traceback (most recent call last):
File “Fluide\script1.py”, line 13, in
datafile = cbook.get_sample_data(‘logo.png’, asfileobj=False)
File
“D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py”,
line 676, in get_sample_data
return myserver.get_sample_data(fname, asfileobj=asfileobj)
File
“D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py”,
line 623, in get_sample_data
raise KeyError(msg)
KeyError: ‘file iselogo.png not in cache; received <urlopen error [Errno
10061] No connection could be made because the target machine actively
refused it> when trying to retrieve’

Does anyone no a solution for this problem? Image is in the same
directory as the script. Or if now I switched to it by os.chdir to the
specific path.

Thanks in advance for your help.

Kindly regards,
Thore Oltersdorf


The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Dear Thomas.

Thanks again for your reply.
I have tried your solution of putting the logo-file into
the folder %HOME% on my Windows system. Actually what happened
is that after invocation of the script the file vanished into the nowhere...
I couldn't see any change in the error output otherwise I would post it here.

Kindly regards,
Thore

PS: Thanks for your hint regarding the multiple post. It was
a stupid mistake and I promise it will never happen again. Sorry again to all annoyed readers.

Thomas Lecocq schrieb:

···

matplotlib.cbook documentation :
http://matplotlib.sourceforge.net/api/cbook_api.html?highlight=matplotlib.cbook#matplotlib.cbook.get_sample_data

matplotlib.cbook.get_sample_data(fname, asfileobj=True)�

Check the cachedirectory ~/.matplotlib/sample_data for a sample_data file. If it does not exist, fetch it with urllib from the mpl svn repo
matplotlib download | SourceForge.net
and store it in the cachedir.
If asfileobj is True, a file object will be returned. Else the path to the file as a string will be returned
To add a datafile to this directory, you need to check out sample_data from matplotlib svn:
svn co matplotlib download | SourceForge.net
and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data.
To bypass all downloading, set the rc parameter examples.download to False and examples.directory to the directory where we should look.

So, you have to have the logo.png image in the home/matplotlib/sample_data. If it is not present there, the script will try to download it from the server.

ps : emailing 3 times the same question doesn't make the answer come faster.

**********************
Thomas Lecocq Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************

Date: Wed, 9 Feb 2011 12:27:21 +0100
From: thore.oltersdorf@...3436...
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Trouble with api example code within watermark_image.py

Dear Developers of Matplotlib,

at first thanks for this mightiest tool for graphical output from python data. I have encountered problems on trying the watermark feature as described at http://matplotlib.sourceforge.net/examples/api/watermark_image.html.

When I invoke the script from a Enthought Python Compiler in the Windows COM then I got this message:

Traceback (most recent call last):
File "Fluide\script1.py", line 13, in <module>
datafile = cbook.get_sample_data('logo.png', asfileobj=False)
File "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", line 676, in get_sample_data
return myserver.get_sample_data(fname, asfileobj=asfileobj)
File "D:\Programme\Enthought\lib\site-packages\matplotlib-1.0.1_r0-py2.6-win32.egg\matplotlib\cbook.py", line 623, in get_sample_data
raise KeyError(msg)
KeyError: 'file iselogo.png not in cache; received <urlopen error [Errno 10061] No connection could be made because the target machine actively refused it> when trying to retrieve'

Does anyone no a solution for this problem? Image is in the same directory as the script. Or if now I switched to it by os.chdir to the specific path.

Thanks in advance for your help.

Kindly regards,
Thore Oltersdorf

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
                 
--
Dipl.-Ing. Thore Oltersdorf
Solar Building Group
Dept. Thermal Systems and Buildings
Fraunhofer-Institut f�r Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0)761/4588-5239 Fax: +49 (0)761/4588-9239
thore.oltersdorf--<1!at!1>--ise.fraunhofer.de
http://www.ise.fraunhofer.de
http://HLK.ise.fraunhofer.de