Modify

Opened 6 years ago

Closed 4 years ago

#3367 closed defect (fixed)

IOError: cannot open resource

Reported by: anonymous Owned by: rjollos
Priority: normal Component: GanttChartPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

I installed ganttchart plugin. but doesn't work. I just followed this web site's guide. (all pre-required installed and using example in this web site)

Here is my trac.log.

/arial                                                                                                                                                           
    result = _eval_expr(data, ctxt, **vars)
  File "/usr/local/lib/python2.5/site-packages/Genshi-0.5-py2.5-linux-i686.egg/genshi/template/base.py", line 286, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/usr/local/lib/python2.5/site-packages/Genshi-0.5-py2.5-linux-i686.egg/genshi/template/eval.py", line 180, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/templates/wiki_view.html", line 37, in <Expression u'wiki_to_html(context, page.text)'>
    ${wiki_to_html(context, page.text)}
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 1095, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 1054, in generate
    escape_newlines)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 833, in format
    self.handle_code_block(line)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 764, in handle_code_block
    processed = self.code_processor.process(code_text)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 179, in process
    text = self.processor(text)
  File "/usr/local/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/wiki/formatter.py", line 160, in _legacy_macro_processor
    text)
  File "build/bdist.linux-i686/egg/gantt/gantt.py", line 202, in render_macro
    self.draw_chart(data,mstart,mend,img_path,80,20,False)
  File "build/bdist.linux-i686/egg/gantt/gantt.py", line 465, in draw_chart
    font = ImageFont.truetype("arial.ttf", 12)
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageFont.py", line 205, in truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "/usr/local/lib/python2.5/site-packages/PIL/ImageFont.py", line 121, in __init__
    self.font = _imagingft.getfont(file, size, index, encoding)
IOError: cannot open resource

Attachments (0)

Change History (11)

comment:1 Changed 6 years ago by thsturm

See closed ticket #3368 with the same problem, but a point to the problem (on Linux)

comment:2 Changed 6 years ago by anonymous

See closed ticket #3349 with the same problem, but a point to the problem (on Linux)

comment:3 Changed 6 years ago by nigelsim

See if you can find a copy of arial.ttf (debian systems can install them with a package called msttcorefonts, look in /usr/share/fonts/truetype/msttcorefonts/).

Now, put this file in the $PWD of the trac script. If you are using tracd, then this is where you called tracd from. In an FCGI scenario then this is the dir where the fcgi script lives (in my case /var/www/cgi-bin).

Ideally there would be a configurable prefix for the fonts, and probably also let you choose an alternative font.

comment:4 Changed 6 years ago by apuredol

Sorry, I am using Apache with mod_wsgi, I have arial.ttf but I couldn´t make it work. Do you have any idea where do I have to put arial.ttf?

comment:6 Changed 6 years ago by anonymous

to solve this do that:

open gantt.py and go to:

font = ImageFont.truetype("arial.ttf", 12)

and add this:

font_path = self.config.get('gantt', 'font_path')
font = ImageFont.truetype(font_path,12)

now in gantt section in yout trac.ini add:

[gantt]
cache_dir = /tmp/gantt_cache
font_path = /path/to/my/font/arial.ttf

now you can use a custom font in a custom place.

comment:8 Changed 5 years ago by anonymous

I have the same issue. Moreover, even after changing the files as suggested by jsantana and re-cooking the egg, the problem was not solved. I've even deleted the egg and the plugin's directory from my machine, then I've downloaded it again and changed the gantt.py before cooking the egg. Trac still shows an error at line 465, which is now commented.

Any clues?

comment:9 Changed 5 years ago by taa@…

On CentOS 5, I solved this using the instruction above, only I installed liberation-fonts instead of the MS fonts.

comment:10 Changed 5 years ago by andreavb1985@…

Him I'm the anonymous who posted on 09/17/09 20:39:21.

I've searched for some liberation-fonts similar package on Debian and I found ttf-liberation, which was already installed on my system.

I still get

 File "/usr/lib/python2.5/site-packages/trac/wiki/templates/wiki_edit.html", line 56, in  <Expression u'wiki_to_html(context(page.resource), page.text)'>  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1095, in  format_to_html  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 1054, in  generate  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 832, in  format  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 763, in  handle_code_block  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 178, in  process  
 File "/usr/lib/python2.5/site-packages/trac/wiki/formatter.py", line 159, in  _legacy_macro_processor  
 File "build/bdist.linux-i686/egg/gantt/gantt.py", line 202, in  render_macro  
 File "build/bdist.linux-i686/egg/gantt/gantt.py", line 465, in  draw_chart  

although my 465 line is a commented one. :(

        # from line 465 to 467
        #font = ImageFont.truetype("arial.ttf", 12)
        font_path = self.config.get ('gantt', 'font_path')
        font = ImageFont.truetype(font_path, 12)

comment:11 Changed 4 years ago by rjollos

  • Owner changed from malsmith to rjollos
  • Status changed from new to assigned

Issue confirmed on Ubuntu 10.04 with Trac 0.11.7. Applying patch from #7129 to see if that fixes the issue.

comment:12 Changed 4 years ago by rjollos

On Ubuntu, the following works:

  • Apply patch in #7129 (to be applied to the trunk in moments).
  • Install the msttcorefonts package.
  • In trac.ini, set font_path = /usr/share/fonts/truetype/msttcorefonts/arial.ttf.

Project wiki page has been updated: wiki/GanttChartPlugin.

comment:11 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9451]) Fixed numerous issues with patch by StefanSimroth. Fixes #7129, #3367.

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.