Message225464
The ast module seems to get confused for certain strings which contain coding declarations.
>>> import ast
>>> s = u'"""\\\n# -*- coding: utf-8 -*-\n"""'
>>> print s
"""\
# -*- coding: utf-8 -*-
"""
>>> ast.literal_eval(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/forcer/Programs/Python/python2.7/lib/python2.7/ast.py", line 49, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "/home/forcer/Programs/Python/python2.7/lib/python2.7/ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 0
SyntaxError: encoding declaration in Unicode string |
|
Date |
User |
Action |
Args |
2014-08-17 19:53:49 | jorgenschaefer | set | recipients:
+ jorgenschaefer |
2014-08-17 19:53:49 | jorgenschaefer | set | messageid: <1408305229.31.0.808680198001.issue22221@psf.upfronthosting.co.za> |
2014-08-17 19:53:49 | jorgenschaefer | link | issue22221 messages |
2014-08-17 19:53:49 | jorgenschaefer | create | |
|