Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save ibizaman/10937380 to your computer and use it in GitHub Desktop.

Select an option

Save ibizaman/10937380 to your computer and use it in GitHub Desktop.
# 3.2
>>> open("test_oauth.py", "r").read()[:30]
'\xef\xbb\xbf# -*- coding: utf-8 -*-\n\n""'
>>> import baron.helpers
>>> baron.helpers.show(open('test_oauth.py').read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/vagrant/baron/baron/helpers.py", line 7, in show
sys.stdout.write(json.dumps(parse(source_code), indent=4) + "\n")
File "/vagrant/baron/baron/baron.py", line 41, in parse
print_function_finder.visit(python_ast_parse(source_code))
File "/usr/lib/python3.2/ast.py", line 36, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 1
# -*- coding: utf-8 -*-
^
SyntaxError: invalid character in identifier
# 2.6
>>> open('test_oauth.py').read()
... ok
>>> import baron.helpers
>>> baron.helpers.show(open('test_oauth.py').read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/vagrant/baron/baron/helpers.py", line 7, in show
sys.stdout.write(json.dumps(parse(source_code), indent=4) + "\n")
File "/vagrant/baron/baron/baron.py", line 55, in parse
return _parse(tokenize(source_code, print_function), print_function)
File "/vagrant/baron/baron/baron.py", line 60, in tokenize
return mark_indentation(inner_group(space_group(_tokenize(group(split(pouet)), print_function))))
File "/vagrant/baron/baron/spliter.py", line 6, in split
return list(split_generator(sequence))
File "/vagrant/baron/baron/spliter.py", line 60, in split_generator
raise Exception("Untreaded elements: %s" % iterator.rest_of_the_sequence().__repr__()[:50])
Exception: Untreaded elements: '\xef\xbb\xbf# -*- coding: utf-8 -*-\n\n"""\nThe M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment