from console, I'm just passing a script to python3.4 which contains similar code. The script I run locally is slightly different in that I load the ttf file from the current directory instead of the web app's static. I do get a similar error if I modify the console script to deliberately load a nonexistant file, which would seem to suggest that I'm just using the wrong url to access /static. However, If I toss that url at a browser I get served the ttf file to download so it would appear to be correct. Perhaps ImageFont.truetype just can't deal with being handed a web url?
Full stack trace follows:
Environment:
Request Method: GET
Request URL: http://brucelet.pythonanywhere.com/calendar/month/2014/6/
Django Version: 1.6.5
Python Version: 3.4.1
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'timezone_field',
'CalendarApp',
'BrucePhrase',
'polls')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/Brucelet/SunMoonCalendar/CalendarApp/views.py" in dynamic_calendar
69. font = ImageFont.truetype(fontpath,144)
File "/home/Brucelet/.local/lib/python3.4/site-packages/PIL/ImageFont.py" in truetype
228. return FreeTypeFont(font, size, index, encoding)
File "/home/Brucelet/.local/lib/python3.4/site-packages/PIL/ImageFont.py" in __init__
131. self.font = core.getfont(font, size, index, encoding)
Exception Type: OSError at /calendar/month/2014/6/
Exception Value: cannot open resource