OpenERP - UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode

StackOverflow https://stackoverflow.com/questions/22091951

  •  18-10-2022
  •  | 
  •  

Domanda

openerp/server/openerp/osv/orm.py:833: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if cols[k][key] != vals[key]:

I see this warning in a log. I don't know when this started happening. And what does it mean? How could I pinpoint the cause of this?

È stato utile?

Soluzione

The problem was, there was some field labels that had non ascii symbols. When I changed to it ascii only symbols, then this warning disappeared.

For example let say it was something like this:

_columns = {
    'some_field': fields.char('Field label with non ascii ęą'),
}

When I changed to:

_columns = {
    'some_field': fields.char('Field label with ascii only'),
}

Warning disappeared.

Altri suggerimenti

Just add u prefix before the string with non-ASCII characters. EX:

_columns = {
'some_field': fields.char(u'Field label with non ascii ęą'),

}

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top