JBKahn / flake8-print

flake8
MIT License
119 stars 22 forks source link

Exception on Windows with Python 2.7 since 1.6 #7

Closed schlamar closed 9 years ago

schlamar commented 9 years ago
Traceback (most recent call last):
  File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File ".tox\flake8\Scripts\flake8.EXE\__main__.py", line 9, in <module>
  File ".tox\flake8\lib\site-packages\flake8\main.py", line 33, in main
    report = flake8_style.check_files()
  File ".tox\flake8\lib\site-packages\pep8.py", line 1670, in check_files
    self.input_dir(path)
  File ".tox\flake8\lib\site-packages\pep8.py", line 1706, in input_dir
    runner(os.path.join(root, filename))
  File ".tox\flake8\lib\site-packages\flake8\engine.py", line 95, in input_file
    return fchecker.check_all(expected=expected, line_offset=line_offset)
  File ".tox\flake8\lib\site-packages\pep8.py", line 1412, in check_all
    self.check_ast()
  File ".tox\flake8\lib\site-packages\pep8.py", line 1359, in check_ast
    for lineno, offset, text, check in checker.run():
  File ".tox\flake8\lib\site-packages\flake8_print.py", line 27, in run
    errors = check_tree_for_print_statements(self.tree, noqa)
  File ".tox\flake8\lib\site-packages\flake8_print.py", line 48, in check_tree_for_print_statements
    if ((isinstance(node, ast.Call) and node.func.id == 'print') or (hasattr(ast, 'Print') and isinstance(node, ast.Print) and node.lineno not in noqa)) and node.lineno not in noqa:
AttributeError: 'Attribute' object has no attribute 'id'
JBKahn commented 9 years ago

Ahhh fun. I didn't check if it had an id attribute before catching it..... I'll patch it this morning. Good catch!

JBKahn commented 9 years ago

Actually I'll patch it this evening. I'll write a few more tests as well.

JBKahn commented 9 years ago

I totally forgot. Tomorrow morning.