Jason R. Coombs added the comment:
> How you got a Unicode source line in SyntaxError?
Good question. Took me a while to replicate the exact conditions, but here's an
example:
#coding: utf-8
from __future__ import unicode_literals
import tokenize
import io
code = """
//
//
"""
buf = io.StringIO(code)
try:
list(tokenize.generate_tokens(buf.readline))
except Exception as exc:
print(exc.args)
It outputs:
('unindent does not match any outer indentation level', ('<tokenize>', 3, 2, u'
//\n'))
> Yeah, it's now time to upgrade to Python 3 ;-)
Love to. Currently, we're blocked in that our code relies on SimpleParse, which
doesn't support Python 3.
> You should write an helper function (class with a write method) encoding
> Unicode strings.
Good idea. I was pondering what I might use as a workaround and your suggestion
sounds suitable. I'll report back how well that works.
----------
type: behavior ->
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29809>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com