Author jorgenschaefer
Recipients jorgenschaefer
Date 2014-08-17.19:53:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408305229.31.0.808680198001.issue22221@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-08-17 19:53:49jorgenschaefersetrecipients: + jorgenschaefer
2014-08-17 19:53:49jorgenschaefersetmessageid: <1408305229.31.0.808680198001.issue22221@psf.upfronthosting.co.za>
2014-08-17 19:53:49jorgenschaeferlinkissue22221 messages
2014-08-17 19:53:49jorgenschaefercreate