Error

Error

Postby emyllymaki » Fri Jan 22, 2010 10:19 pm

I am trying to get report_openoffice working with openerp-server stable/5.0 on ubuntu 8.04 LTS.

I'm using rev4 of report_open_office (lp:report-openoffice).

If I try and use any of the samples from the report_openoffice_samples module I get the following error:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 703, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 291, in create
return fnct(cr, uid, ids, data, report_xml, context)
File "/usr/lib/python2.5/site-packages/openerp-server/report/report_sxw.py", line 426, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 240, in create_single_pdf
return self.create_relatorio_report(cr, uid, ids, data, report_xml, context=context, output='pdf')
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 105, in create_relatorio_report
inzip = zipfile.ZipFile(in_oo, mode='r')
File "/usr/lib/python2.5/zipfile.py", line 346, in __init__
self._GetContents()
File "/usr/lib/python2.5/zipfile.py", line 366, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.5/zipfile.py", line 378, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file

If I try and update any of the report definitions in "Administration|Low Level Objects|Actions|Report XML" I get the following error:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 244, in dispatch
result = LocalService(service_name)(method, *params)
File "/usr/lib/python2.5/site-packages/openerp-server/netsvc.py", line 73, in __call__
return getattr(self, method)(*params)
File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 597, in execute
res = service.execute(db, uid, object, method, *args)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 61, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 120, in execute
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 112, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_xml.py", line 139, in write
parser=load_from_source("from report import report_sxw\n"+vals['parser_def'])
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 326, in load_from_source
exec source in context
File "<string>", line 2
class Parser(report_sxw.rml_parse):

^
SyntaxError: invalid syntax


Thanks for any help.
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby sraps » Sat Jan 23, 2010 12:59 am

Hello,
I am afraid that sample reports are not up to date, so we will have to issue new release for them. We will do this on Monday. Until then you can try to install reports manually.

Kaspars
sraps
 
Posts: 403
Joined: Mon May 04, 2009 10:04 pm

Re: Error

Postby emyllymaki » Sat Jan 23, 2010 3:26 am

Thanks - that's good to hear that it's just he sample reports that need updating.
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby Normunds » Sun Jan 24, 2010 3:44 pm

Checked on Ubuntu Server 9.10 64bit and OpenERP server 5.0.6
I got the same error :
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py", line 687, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/addons/report_openoffice/report_openoffice.py", line 290, in create
return fnct(cr, uid, ids, data, report_xml, context)
File "/usr/local/lib/python2.6/dist-packages/openerp-server/addons/report_openoffice/report_openoffice.py", line 179, in create_relatorio_report
outzip.writestr(f_info, outzip.read(f_info.filename))
File "/usr/lib/python2.6/zipfile.py", line 831, in read
return self.open(name, "r", pwd).read()
File "/usr/lib/python2.6/zipfile.py", line 871, in open
zinfo.orig_filename, fname)
BadZipfile: File name in directory "Configurations2/statusbar/" and header "mimetype" differ.

Something wrong with libs , will check next week.

P.S. Error is caused by python library:
/usr/lib/python2.6/zipfile.py
There are lot of changes in that library in Ubuntu. Centos uses an older one (working). If I replace Ubuntus zipfile.py by that older one form Centos then it is working. BUT I do not recommend to do that. We will check out what's wrong and will fix for Ubuntu in next week.
Normunds
 
Posts: 35
Joined: Tue May 12, 2009 10:34 am

Re: Error

Postby Normunds » Mon Jan 25, 2010 4:20 pm

There were errors.
Check this patch, will add it in next revision.

Code: Select all
--- report_openoffice.py   2010-01-25 14:57:32.000000000 +0200
+++ report_openoffice/report_openoffice.py   2010-01-25 14:32:28.000000000 +0200
@@ -121,7 +121,7 @@ class OpenOffice_parser(report_sxw):
                         style_info = f
                         style_xml = inzip.read(f.filename)
                         continue
-                    outzip.writestr(f, inzip.read(f.filename))
+                    outzip.writestr(f.filename, inzip.read(f.filename))

                 pictures = []
                 dom_style = minidom.parseString(style_xml)
@@ -176,7 +176,7 @@ class OpenOffice_parser(report_sxw):
             if f_info.filename in output_data.keys():
                 outzip.writestr(f_info.filename, output_data[f_info.filename])
             else:
-                outzip.writestr(f_info, outzip.read(f_info.filename))
+                outzip.writestr(f_info.filename, inzip.read(f_info.filename))
         ######################################################################################
         inzip.close()
         in_oo.close()

Normunds
 
Posts: 35
Joined: Tue May 12, 2009 10:34 am

Re: Error

Postby emyllymaki » Tue Jan 26, 2010 5:03 am

Thanks for the patch.

Should the sample reports work now with this patch or will they still need to be updated?
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby emyllymaki » Tue Jan 26, 2010 6:36 pm

The badZipFile error went away but was replaced by another error. It was the one in my above post about the syntax error. There's that string that gets exec-ed """class Parser( ... """ and it kept throwing a syntax error. I was fooling around with it and for whatever reason, if I put a comment after each line it is fixed. I'm sure someone more skilled than I can fix it properly from here.


After *fixing* that error, the badZipFile error is back:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 703, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 292, in create
return fnct(cr, uid, ids, data, report_xml, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 104, in create_relatorio_report
inzip = zipfile.ZipFile(in_oo, mode='r')
File "/usr/lib/python2.5/zipfile.py", line 346, in __init__
self._GetContents()
File "/usr/lib/python2.5/zipfile.py", line 366, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.5/zipfile.py", line 378, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby emyllymaki » Tue Jan 26, 2010 9:08 pm

file_data is always False or None in the OpenOffice_parser.create_relatorio_report() function because "import tools" was missing at the top of report_xml.py.

This was pretty tough to find because it's wrapped in a try and is happy to set the contents to false with no error or log entry.

Now there is a new error:

Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 703, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 313, in create
return fnct(cr, uid, ids, data, report_xml, context)
File "/usr/lib/python2.5/site-packages/openerp-server/report/report_sxw.py", line 426, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 251, in create_single_pdf
return self.create_relatorio_report(cr, uid, ids, data, report_xml, context=context, output='pdf')
File "/opt/openerp/stable/5.0/addons/report_openoffice/report_openoffice.py", line 209, in create_relatorio_report
basic = Template(source=None, filepath=odt_path)
File "/usr/lib/python2.5/site-packages/relatorio-0.5.3-py2.5.egg/relatorio/templates/opendocument.py", line 196, in __init__
encoding, lookup, allow_exec)
File "/usr/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-x86_64.egg/genshi/template/base.py", line 377, in __init__
self.stream = list(self._prepare(self._parse(source, encoding)))
File "/usr/lib/python2.5/site-packages/relatorio-0.5.3-py2.5.egg/relatorio/templates/opendocument.py", line 208, in _parse
content = template._parse(self.insert_directives(content), encoding)
File "/usr/lib/python2.5/site-packages/relatorio-0.5.3-py2.5.egg/relatorio/templates/opendocument.py", line 263, in insert_directives
self._escape_values(tree)
File "/usr/lib/python2.5/site-packages/relatorio-0.5.3-py2.5.egg/relatorio/templates/opendocument.py", line 637, in _escape_values
for element in tree.iter():
AttributeError: 'etree._ElementTree' object has no attribute 'iter'
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby emyllymaki » Tue Jan 26, 2010 9:38 pm

Trying to troubleshoot this, report_openoffice.py hands off the correct path to the tmp odt file here:

basic = Template(source=None, filepath=odt_path)

I added a log line and the path handed to relatorio is a valid odt archive that can be unzipped and looks complete.

This is the version of relatorio that was installed on my system (ubuntu 8.04 LTS): relatorio-0.5.3-py2.5.egg
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Re: Error

Postby emyllymaki » Wed Jan 27, 2010 6:02 am

It looks like the iter method was not introduced in lxml until v2 and on my system it is v 1.3.6.

I have used easy_install lxml=2.0 but that does not seem to replace the v1.3.6 - it installs in parallel but importing lxml still gets you the v1.3.6.

I think maybe Ubuntu needs the older version?
emyllymaki
 
Posts: 17
Joined: Thu Jan 21, 2010 4:04 am

Next

Return to Aeroo Reports & OpenOffice.org Reporting Engine

cron
Copyright © 2001 Alistek Ltd., ALL RIGHTS RESERVED