Modify

Opened 4 years ago

Closed 2 years ago

#8520 closed defect (duplicate)

hours query csv export encoding error

Reported by: anonymous Owned by: rjollos
Priority: high Component: TracHoursPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

When i try to export hours query as csv which link at the bottom of the page.

I get following error:

Oops…
Trac detected an internal error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 32: ordinal not in range(128)

This is probably a local installation issue.

Could you help me please ?

Attachments (0)

Change History (2)

comment:1 in reply to: ↑ description Changed 4 years ago by anonymous

Replying to anonymous:

When i try to export hours query as csv which link at the bottom of the page.

I get following error:

Oops…
Trac detected an internal error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 32: ordinal not in range(128)

This is probably a local installation issue.

Could you help me please ?

You will find below stack trace:

Most recent call last:

    * File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 450, in _dispatch_request
      Code fragment:
       445. try:
       446. if not env and env_error:
       447. raise HTTPInternalError(env_error)
       448. try:
       449. dispatcher = RequestDispatcher(env)
       450. dispatcher.dispatch(req)
       451. except RequestDone:
       452. pass
       453. resp = req._response or []
       454.  
       455. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[u' except RequestDone:', u' pass', u' resp = ...
      before 	[u' try:', u' if not env and env_error:', u' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x99d32ac>
      e 	UnicodeEncodeError('ascii', u'138 - Process AAL-EN avec copie \xe9cran', ...
      env 	<trac.env.Environment object at 0x938f0ec>
      env_error 	None
      exc_info 	(<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'138 ...
      filename 	'/usr/lib/python2.5/site-packages/trac/web/main.py'
      frames 	[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
      has_admin 	True
      line 	u' dispatcher.dispatch(req)'
      lineno 	449
      message 	u"UnicodeEncodeError: 'ascii' codec can't encode character u'\\xe9' in ...
      req 	<Request "GET u'/hours'">
      resp 	[]
      tb 	<traceback object at 0xa2d8414>
      tb_hide 	None
      traceback 	u'Traceback (most recent call last):\n File ...
    * File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 206, in dispatch
      Code fragment:
       201. req.args.get('__FORM_TOKEN') != req.form_token:
       202. raise HTTPBadRequest('Missing or invalid form token. '
       203. 'Do you have cookies enabled?')
       204.  
       205. # Process the request and render the template
       206. resp = chosen_handler.process_request(req)
       207. if resp:
       208. if len(resp) == 2: # Clearsilver
       209. chrome.populate_hdf(req)
       210. template, content_type = \
       211. self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
      chrome 	<trac.web.chrome.Chrome object at 0x99ac8cc>
      err 	(<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'138 ...
      handler 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
      req 	<Request "GET u'/hours'">
      self 	<trac.web.main.RequestDispatcher object at 0x99d32ac>
    * File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 233, in process_request
      Code fragment:
       228. simply send the response itself and not return anything.
       229. """
       230. path = req.path_info.rstrip('/')
       231.  
       232. if path == '/hours':
       233. return self.process_timeline(req)
       234.
       235. if path.startswith('/hours/query'):
       236. return self.save_query(req)
       237.
       238. ### assume a ticket if the other handlers don't work
      Local variables:
      Name	Value
      path 	u'/hours'
      req 	<Request "GET u'/hours'">
      self 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
    * File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 501, in process_timeline
      Code fragment:
       496. req.args.get('page'),
       497. max)
       498. if rm_est_hours: # if not in the columns, remove estimatedhours
       499. cols.pop()
       500.  
       501. return self.display_html(req, query)
       502.  
       503. ### methods lifted from trac.ticket.query
       504.  
       505. def _get_constraints(self, req):
       506. """PLEASE FILL IN THIS DOCSTRING!!!"""
      Local variables:
      Name	Value
      cols 	['id', 'summary', 'time_started', 'seconds_worked', 'worker']
      constraints 	{'status': [u'!bogus']}
      field 	'status'
      format 	u'csv'
      max 	0
      qstring 	u'status!=bogus'
      query 	<trac.ticket.query.Query object at 0xa1e38cc>
      req 	<Request "GET u'/hours'">
      rm_est_hours 	True
      rows 	[]
      self 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
      user 	u'acp'
      val 	u'!bogus'
      vals 	[u'!bogus']
    * File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 806, in display_html
      Code fragment:
       801. if req.args.get('format') == 'rss':
       802. return self.queryhours2rss(req, data)
       803.  
       804. # return the csv, if requested
       805. if req.args.get('format') == 'csv':
       806. self.queryhours2csv(req, data)
       807.  
       808. # add rss link
       809. rss_href = req.href(req.path_info, format='rss')
       810. add_link(req, 'alternate', rss_href, _('RSS Feed'),
       811. 'application/rss+xml', 'rss')
      Local variables:
      Name	Value
      TracUserHours 	<class 'trachours.web_ui.TracUserHours'>
      col 	'worker'
      cols 	['id', 'summary', 'estimatedhours', 'time_started', 'seconds_worked', ...
      constraints 	{'status': {'values': [u'bogus'], 'mode': '!'}}
      context 	<Context <Resource 'query'>>
      data 	{'multiproject': True, 'labels': {'changetime': 'Modified', u'items_list': ...
      db 	<trac.db.pool.PooledConnection object at 0xa2c8aa4>
      desc 	False
      est 	10442880.0
      estimatedhours 	0.0
      f 	{'name': 'time_submitted', 'label': 'Work recorded on'}
      from_date 	datetime.datetime(2011, 2, 11, 0, 0)
      headers 	[{'href': ...
      i 	12
      id 	10858L
      key 	None
      labels 	{'changetime': 'Modified', u'items_list': u'Items List', u'weight': ...
      now 	datetime.datetime(2011, 2, 18, 17, 56, 8, 935704)
      num_items 	153
      order 	None
      orig_list 	[10355, 10855, 10856, 10857, 10860, 10861, 10877, 10878, 10879, 10928, ...
      orig_time 	datetime.datetime(2011, 2, 18, 16, 55, 44, tzinfo=<FixedOffset "UTC" ...
      our_labels 	{'time_started': 'Work done on', 'time_submitted': 'Work recorded on', ...
      query 	<trac.ticket.query.Query object at 0xa1e38cc>
      query_constraints 	u"{'status': [u'!bogus']}"
      query_id 	None
      query_time 	datetime.datetime(2011, 2, 18, 16, 55, 44, tzinfo=<FixedOffset "UTC" ...
      rec 	{u'status': u'work_in_progress', u'changetime': datetime.datetime(2011, 2, ...
      record 	{u'status': u'accepted', u'changetime': datetime.datetime(2011, 2, 18, 16, ...
      records 	[{u'status': u'pending_acceptance', u'changetime': datetime.datetime(2011, ...
      req 	<Request "GET u'/hours'">
      seen_tickets 	set([10250L, 10251L, 10253L, 10256L, 10257L, 10258L, 10259L, 10260L, ...
      self 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
      t 	{u'status': u'work_in_progress', u'changetime': datetime.datetime(2011, 2, ...
      ticket 	{u'status': u'work_in_progress', u'changetime': datetime.datetime(2011, 2, ...
      ticket_data 	{'tickets': [{u'status': u'new', u'changetime': datetime.datetime(2011, 2, ...
      ticket_ids 	[10355, 10855, 10856, 10857, 10860, 10861, 10877, 10878, 10879, 10928, ...
      ticket_times 	[{u'status': u'pending_acceptance', u'changetime': datetime.datetime(2011, ...
      tickets 	[{u'status': u'new', u'changetime': datetime.datetime(2011, 2, 17, 16, 0, ...
      time_records 	[{u'status': u'pending_acceptance', u'changetime': datetime.datetime(2011, ...
      time_records_by_ticket 	{10250L: [{u'status': u'work_in_progress', u'changetime': ...
      to_date 	datetime.datetime(2011, 2, 18, 17, 56, 8, 935704)
      total_estimated_time 	0
      total_estimated_times 	{None: '2900.8'}
      total_time 	0
      total_times 	{None: '1067.9'}
    * File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 1008, in queryhours2csv
      Code fragment:
      1003. if groupname:
      1004. writer.writerow(groupname)
      1005. writer.writerow([header['label'] for header in data['headers']])
      1006. for result in results:
      1007. writer.writerow([result[header['name']]
      1008. for header in data['headers']])
      1009. writer.writerow([])
      1010.  
      1011. req.send(buffer.getvalue(), "text/csv")
      1012.  
      1013.  
      Local variables:
      Name	Value
      buffer 	<StringIO.StringIO instance at 0xa39c5ec>
      constraint 	'status'
      data 	{'multiproject': True, 'labels': {'changetime': 'Modified', u'items_list': ...
      format 	'%B %d, %Y'
      groupname 	None
      header 	{'href': ...
      i 	'to_date'
      req 	<Request "GET u'/hours'">
      result 	{u'status': u'pending_for_start', u'changetime': datetime.datetime(2011, ...
      results 	[{u'status': u'pending_acceptance', u'changetime': datetime.datetime(2011, ...
      self 	<trachours.hours.TracHoursPlugin object at 0x99d30ec>
      title 	'Hours'
      writer 	<_csv.writer object at 0xbb3d0ec>

File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 450, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 206, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 233, in process_request
  return self.process_timeline(req)
File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 501, in process_timeline
  return self.display_html(req, query)
File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 806, in display_html
  self.queryhours2csv(req, data)
File "/usr/lib/python2.5/site-packages/TracHoursPlugin-0.5.2-py2.5.egg/trachours/hours.py", line 1008, in queryhours2csv
  for header in data['headers']])

comment:2 Changed 2 years ago by rjollos

  • Resolution set to duplicate
  • Status changed from new to closed

#10233 has a patch so closing this one as a duplicate.

Add Comment

Modify Ticket

Action
as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.