Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mako.exceptions Tries to do b"bytes".split() when rendering text_error_template, and fails (in Python 3) #209

sqlalchemy-bot opened this issue Feb 20, 2013 · 2 comments
bug Something isn't working low priority runtime


Copy link

Migrated issue, originally created by Anonymous

Magical combination:

  • Python 3
  • TemplateLookup being used with...
  • ...module_directory
  • Template's render() must fail (due to no such argument, for example)
  • While handling exception, do mako.exceptions.text_error_template().render()


While trying to display error template, another exception is thrown because byte-strings don't have split().

"''During handling of the above exception, another exception occurred [...snip...] for line in module_source.split("\n"):
TypeError: Type str doesn't support the buffer API''"


To "fix" this, change line 170 in mako/ from:

for line in module_source.split("\n"):

for line in module_source.decode('utf-8').split("\n"):

I believe 'utf-8' will need to be replaced with something else.

Attachments: my_template.html |

Copy link

Michael Bayer (@zzzeek) wrote:

thanks! I was able to reproduce this with our own fixtures. 779e1f3 fixes it, give it a try and let me know. I might call this release 0.8.0.

Copy link

Changes by Michael Bayer (@zzzeek):

  • removed labels: easy
  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Something isn't working low priority runtime
None yet

No branches or pull requests

1 participant