Modify

Opened 10 years ago

Closed 9 years ago

#2504 closed defect (fixed)

TypeError: cannot return std::string from Unicode object

Reported by: jyder4@… Owned by: Bhuricha Deen Sethanandha
Priority: high Component: TracMetrixPlugin
Severity: major Keywords:
Cc: jyder4@… Trac Release: 0.11

Description (last modified by Bhuricha Deen Sethanandha)

Error was occured when I click one of the milestone from table of milestone at dashboard.

How to Reproduce

While doing a GET operation on /mdashboard/4.3.1.3, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'id': u'4.3.1.3', 'imagename': None}

System Information

Trac 0.11dev-r6425
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
setuptools 0.6c7
SQLite 3.5.2
pysqlite 2.4.0
Genshi 0.5dev-r789
mod_python 3.3.1
Pygments 0.9
Subversion 1.4.6 (r28521)

Python Traceback

Traceback (most recent call last):
  File "g:\python25\lib\site-packages\Trac-0.11dev_r6425-py2.5.egg\trac\web\main.py", line 406, in _dispatch_request
    dispatcher.dispatch(req)
  File "g:\python25\lib\site-packages\Trac-0.11dev_r6425-py2.5.egg\trac\web\main.py", line 195, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\tracmetrixplugin\mdashboard.py", line 431, in process_request
    return self._render_view(req, db, milestone)
  File "build\bdist.win32\egg\tracmetrixplugin\mdashboard.py", line 557, in _render_view
    create_cumulative_chart(self.env, milestone, numdates, tkt_cumulative_table)
  File "build\bdist.win32\egg\tracmetrixplugin\mdashboard.py", line 324, in create_cumulative_chart
    fig.savefig(path)
  File "G:\Python25\Lib\site-packages\matplotlib\figure.py", line 782, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "G:\Python25\Lib\site-packages\matplotlib\backend_bases.py", line 1195, in print_figure
    **kwargs)
  File "G:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", line 397, in print_png
    self.get_renderer()._renderer.write_png(filename, self.figure.dpi.get())
TypeError: cannot return std::string from Unicode object

Attachments (0)

Change History (4)

comment:1 Changed 9 years ago by raymond.wooninck@…

I had the same problem and I was able to fix it by playing with the version of the matplotlib. I am running TRAC on Windows 2003 under Apache 2.2 and I had installed all latest versions of the indicated requirements. This lead to the same error as you described. I tried to lower the versions of all the requirements to the recommended version, but was unable to do this for Pygtk. With matplotlib 0.87-7 I received a different error, but now I am running with version 0.90.0 and this one solves the errors.

It might be worth it to try matplotlib versions lower than 0.91. What I found on the internet is that with this version a change was made how Unicode fonts are translated.

Raymond

comment:2 in reply to:  1 Changed 9 years ago by Richard Wall

Replying to raymond.wooninck@cchellenic.com:

I had the same problem and I was able to fix it by playing with the version of the matplotlib.

<snip>

It might be worth it to try matplotlib versions lower than 0.91. What I found on the internet is that with this version a change was made how Unicode fonts are translated.

Thanks for the pointer. Have just installed TracMetrixPlugin with Trac 0.11.1 on Ubuntu Hardy and got the same error. I manually applied the following change to python2.5-matplotlib (0.91.2-0ubuntu1) and the page and graph work again. See:

  • branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py

     
    394394
    395395    def print_png(self, filename, *args, **kwargs):
    396396        self.draw()
     397        filename = str(filename) # until we figure out unicode handling
    397398        self.get_renderer()._renderer.write_png(filename, self.figure.dpi.get())
    398399

comment:3 Changed 9 years ago by Richard Wall

Note duplicate ticket #2900

comment:4 Changed 9 years ago by Bhuricha Deen Sethanandha

Description: modified (diff)
Resolution: fixed
Status: newclosed

I just add the code to use Yahoo chart to plot instead of the Matplotlib. This problem should be fixed.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Bhuricha Deen Sethanandha.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.