← Back to team overview

openerp-india team mailing list archive

[Bug 1300731] [NEW] [Trunk] POS receipt error with non-ascii characters

 

Public bug reported:

When printing a receipt from POS I get the following error when
including non-ascii characters, like the 'ñ' in España:

Receipt text:
==========================
'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
--------------------------------------------
Traceback (most recent call last):
 File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 685, in receipt
root         = ET.fromstring(xml)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML parser.feed(text)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1640, in feed self._parser.Parse(data, 0)
'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
--------------------------------------------
=========================

Log text:
=========================
2014-04-01 11:21:17,126 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: ESC/POS Error: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
2014-04-01 11:21:17,129 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/openerp/inestable/addons/hw_escpos/controllers/main.py", line 123, in run
    printer.receipt(data)
  File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 702, in receipt
    raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
------------------------------------------------------------
===========================

Full log:
===========================
$ bzr revno openobject-addons/
9275
$ ./openerp-server --addons-path=addons -r openerp -w xxxxx
2014-04-01 11:20:20,684 1288 INFO ? openerp: OpenERP version 8.0alpha1
2014-04-01 11:20:20,684 1288 INFO ? openerp: addons paths: ['/opt/openerp/.local/share/OpenERP/addons/8.0', u'/opt/openerp/inestable/addons', '/opt/openerp/inestable/openerp/addons']
2014-04-01 11:20:20,685 1288 INFO ? openerp: database hostname: localhost
2014-04-01 11:20:20,685 1288 INFO ? openerp: database port: 5432
2014-04-01 11:20:20,685 1288 INFO ? openerp: database user: openerp
2014-04-01 11:20:20,954 1288 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2014-04-01 11:20:23,786 1288 ERROR ? openerp.addons.report.models.report: You need wkhtmltopdf to print a pdf version of the reports.
2014-04-01 11:20:24,024 1288 WARNING ? openerp.addons.website_event.controllers.main: Please install GeoIP python module to use events localisation.
2014-04-01 11:20:24,250 1288 INFO ? openerp.http: HTTP Configuring static files
2014-04-01 11:20:24,312 1288 INFO Bar openerp.modules.loading: loading 1 modules...
2014-04-01 11:20:24,484 1288 INFO Bar openerp.modules.loading: loading 38 modules...
ESC/POS: please install jcconv for improved Japanese receipt printing:
 # pip install jcconv
2014-04-01 11:20:25,656 1288 INFO Bar openerp.modules.loading: Modules loaded.
2014-04-01 11:20:25,661 1288 INFO Bar openerp.addons.base.ir.ir_http: Generating routing map
2014-04-01 11:20:25,894 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:25] "POST /hw_proxy/status_json HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.1.10', 53108)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Tubería rota
----------------------------------------
Could not set configuration: [Errno 16] Resource busy
2014-04-01 11:20:29,673 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:29] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:34,699 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:34] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:39,721 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:39] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:44,751 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:44] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:47,921 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:47] "GET /hw_proxy/status HTTP/1.1" 200 -
2014-04-01 11:20:49,781 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:49] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:54,803 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:54] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:20:56,775 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:56] "GET /hw_proxy/status HTTP/1.1" 200 -
2014-04-01 11:20:59,827 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:59] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:21:04,850 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:04] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:21:09,877 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:09] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:21:14,904 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:14] "POST /hw_proxy/status_json HTTP/1.1" 200 -
2014-04-01 11:21:16,514 1288 INFO Bar openerp.addons.hw_escpos.controllers.main: ESC/POS: OPEN CASHBOX
2014-04-01 11:21:16,569 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/open_cashbox HTTP/1.1" 200 -
2014-04-01 11:21:16,638 1288 INFO Bar openerp.addons.hw_proxy.controllers.main: push_order {'user_id': 1, 'name': 'Order 1396348077177', 'partner_id': False, 'amount_paid': 10, 'pos_session_id': 4, 'lines': [], 'statement_ids': [[0, 0, {'journal_id': 8, 'amount': 10, 'name': '2014-04-01 11:21:16', 'account_id': 3099, 'statement_id': 7}]], 'amount_tax': 0, 'uid': 1396348077177L, 'amount_return': 10, 'amount_total': 0}
2014-04-01 11:21:16,653 1288 INFO Bar openerp.addons.hw_escpos.controllers.main: ESC/POS: PRINT XML RECEIPT
2014-04-01 11:21:16,662 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/log HTTP/1.1" 200 -
2014-04-01 11:21:16,682 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/print_xml_receipt HTTP/1.1" 200 -
Could not set configuration: [Errno 16] Resource busy
2014-04-01 11:21:17,126 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: ESC/POS Error: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
2014-04-01 11:21:17,129 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/openerp/inestable/addons/hw_escpos/controllers/main.py", line 123, in run
    printer.receipt(data)
  File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 702, in receipt
    raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
------------------------------------------------------------

2014-04-01 11:21:17,331 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:17] "POST /web/dataset/call_kw/pos.order/create_from_ui HTTP/1.1" 200 -
2014-04-01 11:21:19,925 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:19] "POST /hw_proxy/status_json HTTP/1.1" 200 -
Could not set configuration: [Errno 16] Resource busy
2014-04-01 11:21:24,943 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:24] "POST /hw_proxy/status_json HTTP/1.1" 200 -
Could not set configuration: [Errno 16] Resource busy
^C2014-04-01 11:21:29,890 1288 INFO ? openerp.service.server: Initiating shutdown
2014-04-01 11:21:29,891 1288 INFO ? openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
=========================

The first error in the full log apeared after -u all, doesn't seems
related to the original error, who was there prior to the today's
update.

To reproduce, on a Linux server with addons rev.9275, web 3962 and
server 5158 install a new database, install POS, hw_proxy, spanish chart
of accounts, and put some non-ascii chars in the company's address. Then
try to print a receipt via the hw_proxy.

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: pos

** Summary changed:

- Tiket prints error with non-ascii characters
+ POS receipt error with non-ascii characters

** Summary changed:

- POS receipt error with non-ascii characters
+ [Trunk] POS receipt error with non-ascii characters

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1300731

Title:
  [Trunk] POS receipt error with non-ascii characters

Status in OpenERP Addons (modules):
  New

Bug description:
  When printing a receipt from POS I get the following error when
  including non-ascii characters, like the 'ñ' in España:

  Receipt text:
  ==========================
  'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  --------------------------------------------
  Traceback (most recent call last):
   File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 685, in receipt
  root         = ET.fromstring(xml)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML parser.feed(text)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1640, in feed self._parser.Parse(data, 0)
  'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  --------------------------------------------
  =========================

  Log text:
  =========================
  2014-04-01 11:21:17,126 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: ESC/POS Error: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  2014-04-01 11:21:17,129 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  ------------------------------------------------------------
  Traceback (most recent call last):
    File "/opt/openerp/inestable/addons/hw_escpos/controllers/main.py", line 123, in run
      printer.receipt(data)
    File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 702, in receipt
      raise e
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  ------------------------------------------------------------
  ===========================

  Full log:
  ===========================
  $ bzr revno openobject-addons/
  9275
  $ ./openerp-server --addons-path=addons -r openerp -w xxxxx
  2014-04-01 11:20:20,684 1288 INFO ? openerp: OpenERP version 8.0alpha1
  2014-04-01 11:20:20,684 1288 INFO ? openerp: addons paths: ['/opt/openerp/.local/share/OpenERP/addons/8.0', u'/opt/openerp/inestable/addons', '/opt/openerp/inestable/openerp/addons']
  2014-04-01 11:20:20,685 1288 INFO ? openerp: database hostname: localhost
  2014-04-01 11:20:20,685 1288 INFO ? openerp: database port: 5432
  2014-04-01 11:20:20,685 1288 INFO ? openerp: database user: openerp
  2014-04-01 11:20:20,954 1288 INFO ? openerp.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
  2014-04-01 11:20:23,786 1288 ERROR ? openerp.addons.report.models.report: You need wkhtmltopdf to print a pdf version of the reports.
  2014-04-01 11:20:24,024 1288 WARNING ? openerp.addons.website_event.controllers.main: Please install GeoIP python module to use events localisation.
  2014-04-01 11:20:24,250 1288 INFO ? openerp.http: HTTP Configuring static files
  2014-04-01 11:20:24,312 1288 INFO Bar openerp.modules.loading: loading 1 modules...
  2014-04-01 11:20:24,484 1288 INFO Bar openerp.modules.loading: loading 38 modules...
  ESC/POS: please install jcconv for improved Japanese receipt printing:
   # pip install jcconv
  2014-04-01 11:20:25,656 1288 INFO Bar openerp.modules.loading: Modules loaded.
  2014-04-01 11:20:25,661 1288 INFO Bar openerp.addons.base.ir.ir_http: Generating routing map
  2014-04-01 11:20:25,894 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:25] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  ----------------------------------------
  Exception happened during processing of request from ('192.168.1.10', 53108)
  Traceback (most recent call last):
    File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
      self.finish_request(request, client_address)
    File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
      self.RequestHandlerClass(request, client_address, self)
    File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
      self.finish()
    File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
      self.wfile.close()
    File "/usr/lib/python2.7/socket.py", line 279, in close
      self.flush()
    File "/usr/lib/python2.7/socket.py", line 303, in flush
      self._sock.sendall(view[write_offset:write_offset+buffer_size])
  error: [Errno 32] Tubería rota
  ----------------------------------------
  Could not set configuration: [Errno 16] Resource busy
  2014-04-01 11:20:29,673 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:29] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:34,699 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:34] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:39,721 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:39] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:44,751 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:44] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:47,921 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:47] "GET /hw_proxy/status HTTP/1.1" 200 -
  2014-04-01 11:20:49,781 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:49] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:54,803 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:54] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:20:56,775 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:56] "GET /hw_proxy/status HTTP/1.1" 200 -
  2014-04-01 11:20:59,827 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:20:59] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:21:04,850 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:04] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:21:09,877 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:09] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:21:14,904 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:14] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  2014-04-01 11:21:16,514 1288 INFO Bar openerp.addons.hw_escpos.controllers.main: ESC/POS: OPEN CASHBOX
  2014-04-01 11:21:16,569 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/open_cashbox HTTP/1.1" 200 -
  2014-04-01 11:21:16,638 1288 INFO Bar openerp.addons.hw_proxy.controllers.main: push_order {'user_id': 1, 'name': 'Order 1396348077177', 'partner_id': False, 'amount_paid': 10, 'pos_session_id': 4, 'lines': [], 'statement_ids': [[0, 0, {'journal_id': 8, 'amount': 10, 'name': '2014-04-01 11:21:16', 'account_id': 3099, 'statement_id': 7}]], 'amount_tax': 0, 'uid': 1396348077177L, 'amount_return': 10, 'amount_total': 0}
  2014-04-01 11:21:16,653 1288 INFO Bar openerp.addons.hw_escpos.controllers.main: ESC/POS: PRINT XML RECEIPT
  2014-04-01 11:21:16,662 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/log HTTP/1.1" 200 -
  2014-04-01 11:21:16,682 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:16] "POST /hw_proxy/print_xml_receipt HTTP/1.1" 200 -
  Could not set configuration: [Errno 16] Resource busy
  2014-04-01 11:21:17,126 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: ESC/POS Error: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  2014-04-01 11:21:17,129 1288 ERROR ? openerp.addons.hw_escpos.controllers.main: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  ------------------------------------------------------------
  Traceback (most recent call last):
    File "/opt/openerp/inestable/addons/hw_escpos/controllers/main.py", line 123, in run
      printer.receipt(data)
    File "/opt/openerp/inestable/addons/hw_escpos/escpos/escpos.py", line 702, in receipt
      raise e
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 26552: ordinal not in range(128)
  ------------------------------------------------------------

  2014-04-01 11:21:17,331 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:17] "POST /web/dataset/call_kw/pos.order/create_from_ui HTTP/1.1" 200 -
  2014-04-01 11:21:19,925 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:19] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  Could not set configuration: [Errno 16] Resource busy
  2014-04-01 11:21:24,943 1288 INFO Bar werkzeug: 192.168.1.10 - - [01/Apr/2014 11:21:24] "POST /hw_proxy/status_json HTTP/1.1" 200 -
  Could not set configuration: [Errno 16] Resource busy
  ^C2014-04-01 11:21:29,890 1288 INFO ? openerp.service.server: Initiating shutdown
  2014-04-01 11:21:29,891 1288 INFO ? openerp.service.server: Hit CTRL-C again or send a second signal to force the shutdown.
  =========================

  The first error in the full log apeared after -u all, doesn't seems
  related to the original error, who was there prior to the today's
  update.

  To reproduce, on a Linux server with addons rev.9275, web 3962 and
  server 5158 install a new database, install POS, hw_proxy, spanish
  chart of accounts, and put some non-ascii chars in the company's
  address. Then try to print a receipt via the hw_proxy.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1300731/+subscriptions


Follow ups

References