I am running a server written in python, and this error appears when I run it:
Traceback (most recent call last):
File "desarrollo/open/server/bin/openerp-server.py", line 124, in <module>
pooljobs=False)
File "/home/daniel/desarrollo/open/server/bin/pooler.py", line 47, in get_db_and_pool
pool.get('ir.actions.report.xml').register_all(cr)
File "/home/daniel/desarrollo/open/server/bin/addons/base/ir/ir_actions.py", line 100, in register_all
opj('addons',r['report_xml']),
File "/usr/lib/python2.7/posixpath.py", line 75, in join
if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'
I have python installed on 2 computers, with the same version and on one it works perfect, but on the other computer it does not.
I know that the startswith function works with strings, but I do not know why NoneType tells me when the on another computer runs correctly.
The error is exploiting with python itself:
/usr/lib/python2.7/posixpath.py
not in the server files or modules, therefore the posixpath file can not be modified. I guess because it's the internal code of some python function
As you can see, I am using Ubuntu, 14.04, and the version of the python in 2.7.6 This is the same for both teams.
This is the code of register_all:
def register_all(self, cr):
"""Report registration handler that may be overridden by subclasses to
add their own kinds of report services.
Loads all reports with no manual loaders (auto==True) and
registers the appropriate services to implement them.
"""
opj = os.path.join
cr.execute("SELECT * FROM ir_act_report_xml WHERE auto=%s ORDER BY id", (True,))
result = cr.dictfetchall()
svcs = netsvc.Service._services
for r in result:
print r['report_xml'] # NO puedo poner el print aquí porque me da error de identación...
if svcs.has_key('report.'+r['report_name']): #...con esta línea, pero no entiendo, pues está bien identado
continue
if r['report_rml'] or r['report_rml_content_data']:
report_sxw('report.'+r['report_name'], r['model'],
opj('addons',r['report_rml'] or '/'), header=r['header'])
if r['report_xsl']:
report_rml('report.'+r['report_name'], r['model'],
opj('addons',r['report_xml']),
r['report_xsl'] and opj('addons',r['report_xsl']))
print r['report_xml'] # Aqui el print de depuracion no me da error
Debugging with prints this function on both computers, the value r ['report_xml'] is sometimes none or it can be a path to an xml file. I suppose that when there is no xml the value is none. The issue is that with some value None of the machine that gives error, try to enter the attribute startswith.
The error I get in the first print is:
ir_actions.py:94:57: unindent does not match any outer indentation level
if svcs.has_key('report.'+r['report_name']): # Y no comprendo...
I would like you to help me see what is, or what is not in this pc that does not work ...
Greetings