Several errors while running pyreport

Asked by ocefpaf

Dear pyreport developers,

First of all I would like to congratulate you for this project, it is a very nice tool not only to create reports, but also to use as a "teaching-tool". This is my main interest in this script, I want to learn python to be able to teach it later using literate hand-outs and web pages.

However, I'm having two problems:

1) I' a complete beginner in python.

2) Although I manage to install pyreport and its dependencies, I still cannot run it successfully.

My plataform:
Opensuse 11.1 - Linux linux-9qsu 2.6.27.25-0.1-pae #1 SMP 2009-07-01 15:37:09 +0200 i686 i686 i386 GNU/Linux
Python Version: 2.6
python-matplotlib Version: 0.98.5.2-0.pm.1
python-scipy Version: 0.7.1-2.2
pyreport 0.3.3 (installed via easy install)

Calling the program (example.py is the first example found at the web-page http://gael-varoquaux.info/computers/pyreport/ ):
pyreport -t html example.py -o example.html

The output:
Error in executing script on block starting line 2 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 4, in <module>
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/scipy/__init__.py", line 11, in <module>
    from numpy import show_config as show_numpy_config
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/numpy/__init__.py", line 130, in <module>
    import add_newdocs
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/numpy/add_newdocs.py", line 9, in <module>
    from lib import add_newdoc
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/numpy/lib/__init__.py", line 4, in <module>
    from type_check import *
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/numpy/lib/type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/numpy/core/__init__.py", line 6, in <module>
    import umath
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
TypeError: __call__() takes at most 5 arguments (6 given)

Error in executing script on block starting line 3 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 275, in __call__
    return self.pylab_import(name, globals, locals, fromlist)
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 281, in pylab_import
    matplotlib = self.original_import("matplotlib")
  File "/usr/lib/python2.6/site-packages/matplotlib/__init__.py", line 129, in <module>
    from rcsetup import defaultParams, validate_backend, validate_toolbar
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/matplotlib/rcsetup.py", line 18, in <module>
    from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/matplotlib/fontconfig_pattern.py", line 23, in <module>
    from matplotlib.pyparsing import Literal, ZeroOrMore, \
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 276, in __call__
    return self.original_import(name, globals, locals, fromlist)
  File "/usr/lib/python2.6/site-packages/matplotlib/pyparsing.py", line 3207, in <module>
    _escapedHexChar = Combine( Suppress(_bslash + "0x") + Word(hexnums) ).setParseAction(lambda s,l,t:unichr(int(t[0],16)))
  File "/usr/lib/python2.6/site-packages/matplotlib/pyparsing.py", line 2923, in __init__
    self.leaveWhitespace()
  File "/usr/lib/python2.6/site-packages/matplotlib/pyparsing.py", line 2565, in leaveWhitespace
    self.expr = self.expr.copy()
  File "/usr/lib/python2.6/site-packages/matplotlib/pyparsing.py", line 681, in copy
    cpy = copy.copy( self )
  File "/usr/lib/python2.6/copy.py", line 87, in copy
    rv = reductor(2)
TypeError: __call__() takes at most 5 arguments (6 given)

Error in executing script on block starting line 14 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 4, in <module>
NameError: name 'ogrid' is not defined

Error in executing script on block starting line 16 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'x' is not defined

Error in executing script on block starting line 19 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 4, in <module>
NameError: name 'zeros_like' is not defined

Error in executing script on block starting line 20 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 4, in <module>
NameError: name 'z' is not defined

Error in executing script on block starting line 23 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'figure' is not defined

Error in executing script on block starting line 24 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'axes' is not defined

Error in executing script on block starting line 25 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'axis' is not defined

Error in executing script on block starting line 26 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'imshow' is not defined

Error in executing script on block starting line 27 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'bone' is not defined

Error in executing script on block starting line 28 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'show' is not defined

Error in executing script on block starting line 31 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'axis' is not defined

Error in executing script on block starting line 32 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'rcParams' is not defined

Error in executing script on block starting line 35 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 4, in <module>
NameError: name 'zeros_like' is not defined

Error in executing script on block starting line 44 :
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 193, in executeblock
    exec block_text in self.namespace
  File "<string>", line 3, in <module>
NameError: name 'show' is not defined

Outputing report to example.html.html
Traceback (most recent call last):
  File "/usr/local/bin/pyreport", line 8, in <module>
    load_entry_point('pyreport==0.3.3', 'console_scripts', 'pyreport')()
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 1200, in commandline_call
    main(pyfile, overrides=options)
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 1256, in main
    compiler.compile( output_list, options.outfile, options)
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 871, in compile
    html_string = rst2html(self.blocks2rst_string(output_list))
  File "/usr/local/lib/python2.6/site-packages/pyreport-0.3.3-py2.6.egg/pyreport/pyreport.py", line 654, in rst2html
    writer_name='html', settings_overrides=overrides)
  File "/usr/lib/python2.6/site-packages/docutils/core.py", line 397, in publish_string
    enable_exit_status=enable_exit_status)
  File "/usr/lib/python2.6/site-packages/docutils/core.py", line 612, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/usr/lib/python2.6/site-packages/docutils/core.py", line 206, in publish
    output = self.writer.write(self.document, self.destination)
  File "/usr/lib/python2.6/site-packages/docutils/writers/__init__.py", line 79, in write
    output = self.destination.write(self.output)
  File "/usr/lib/python2.6/site-packages/docutils/io.py", line 331, in write
    self.destination = self.encode(data)
  File "/usr/lib/python2.6/site-packages/docutils/io.py", line 161, in encode
    return data.encode(self.encoding, self.error_handler)
  File "/usr/lib/python2.6/encodings/__init__.py", line 100, in search_function
    level=0)
TypeError: __call__() got an unexpected keyword argument 'level'

Thanks you for any help, Filipe.

Question information

Language:
English Edit question
Status:
Answered
For:
pyreport Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Gael Varoquaux (gael-varoquaux) said :
#2

On Tue, Aug 18, 2009 at 05:58:11PM -0000, ocefpaf wrote:
> New question #80353 on pyreport:
> https://answers.launchpad.net/pyreport/+question/80353

> Dear pyreport developers,

> First of all I would like to congratulate you for this project, it is a very nice tool not only to create reports, but also to use as a "teaching-tool". This is my main interest in this script, I want to learn python to be able to teach it later using literate hand-outs and web pages.

This was a bug in pyreport that created import errors on python 2.6. I
believe it was creating the tracebacks that you have seen. Hopefully this
should be fixed in 0.3.4b.

Cheers,

Gaël

Revision history for this message
ocefpaf (ocefpaf) said :
#3

Thank you for the feedback. I've been trying version 0.3.4b with partial success. However, due to my inexperience, I'm still having a couple of problems.

1) During the installation, the easy_install complains about this line:
> PYTHON_VERSION = int(''.join(platform.python_version_tuple()[:2]))

I made a "horrible" override and the installation was successful:

> PYTHON_VERSION = 26

2) The second issue happens when my python scripts call Matplotlib 0.99.1 or latex syntax. Pyreport works perfectly otherwise.

Here is the output when I try to run:
> http://pastebin.com/m443869ce

and here is the python script:
> http://pastebin.com/m54062c6c

Thanks again for the feedback, I hope to learn python more the be of a greater help.

ps:
My plataform changed a little bit

Opensuse 11.2 - 2.6.30rc6-pae
docutils: 0.5-7.1
Python: 2.6.2-6.3
python-matplotlib Version: 0.99.1
python-scipy: 0.7.1-2.2
pyreport 0.3.4a (installed via easy install)

Revision history for this message
ocefpaf (ocefpaf) said :
#4

Sorry I misspoke regarding pyreport versions, those comments above applies for pyreport 34a.

Version 34b installation runs OK. Also the Matplolib graphs are shown in the pdf.
However I still cannot translate the Latex comments.. In addition the following message is echoed to the pdf:

> /pyreport.py:289: DeprecationWarning: the sets m...level=level)

Sorry the message is cut off in the pdf.

Thanks, Filipe.

Revision history for this message
Gael Varoquaux (gael-varoquaux) said :
#5

On Sat, Nov 14, 2009 at 12:31:04AM -0000, ocefpaf wrote:
> ocefpaf gave more information on the question:
> Sorry I misspoke regarding pyreport versions, those comments above
> applies for pyreport 34a.

Indeed, I fixed those bugs in 3.4b

> Version 34b installation runs OK. Also the Matplolib graphs are shown
> in the pdf. However I still cannot translate the Latex comments..

You need to use the '-l' option of pyreport. See the help echoed by
'pyreport -h'. With the right option, LaTeX seems to be working for me.

> In addition the following message is echoed to the pdf:

> > /pyreport.py:289: DeprecationWarning: the sets m...level=level)

> Sorry the message is cut off in the pdf.

I can't reproduce this (probably because I don't have the exact same
Python version as you do). If the full message can be seen in the
terminal output, it would be great if you could send it to me.

Cheers,

Gaël

Revision history for this message
ocefpaf (ocefpaf) said :
#6

> You need to use the '-l' option of pyreport. See the help echoed by
> 'pyreport -h'. With the right option, LaTeX seems to be working for me.

I was using the -l option. However I realized that my problem was the comments. They need to start like "#$", without any spaces. I was using "# $" throughout the script comments. Now Latex works!

> I can't reproduce this (probably because I don't have the exact same
> Python version as you do). If the full message can be seen in the
> terminal output, it would be great if you could send it to me.

The terminal output is this:
http://pastebin.com/m72d294b7

The full message is this:
/usr/local/lib/python2.6/site-packages/pyreport-0.3.4b-py2.6.egg/pyreport/pyreport.py:289: DeprecationWarning: the sets module is deprecated
  level=level)

I was able to read it outputting to .tex instead of the .pdf. That also allowe a quick-and-dirty-workaround to clean the error message from my final pdfs.

Thanks for the help. Filipe

Revision history for this message
Gael Varoquaux (gael-varoquaux) said :
#7

On Sat, Nov 14, 2009 at 03:13:28PM -0000, ocefpaf wrote:
> > I can't reproduce this (probably because I don't have the exact same
> > Python version as you do). If the full message can be seen in the
> > terminal output, it would be great if you could send it to me.

> The terminal output is this:
> http://pastebin.com/m72d294b7

> The full message is this:
> /usr/local/lib/python2.6/site-packages/pyreport-0.3.4b-py2.6.egg/pyreport/pyreport.py:289: DeprecationWarning: the sets module is deprecated
> level=level)

I am wondering if this is related to pyreport, or to a module that you
are importing. Are you getting this warning if you run your script
outside of pyreport?

Gaël

Revision history for this message
ocefpaf (ocefpaf) said :
#8

Here is my test script (sorry I should have sent it before):

http://pastebin.com/m17eb5dd1

It is a slightly modified version of the simplest example you made available at you homepage. The only module that get imported is here "from pylab import *". My experience with python is very limited to track inside pylab what is calling the "sets module", or if pyreport is calling it.

Anyway, it is working is a satisfactory way now.

My suggestion is, if it is possible, to output the "warnings" in a separated document/file or even at the last page of the report. That way the report is always "clean", no matter if one is calling some obscure/old/deprecated module, and the warnings can be checked later.

Thanks you for the quick answer and the software. Pyreport is a nice piece of code, simple and useful!
I tried other alternatives and none were able to quickly integrated Latex and Matplolib graphs in such a straight forward way as pyreport does.

Can you help with this problem?

Provide an answer of your own, or ask ocefpaf for more information if necessary.

To post a message you must log in.