spulec / pep8ify

A library that modifies python source code to conform to pep8.
Apache License 2.0
118 stars 12 forks source link

AttributeError: 'NoneType' object has no attribute 'prefix' #23

Closed giampaolo closed 10 years ago

giampaolo commented 10 years ago
Traceback (most recent call last):
  File "/usr/local/bin/pep8ify", line 9, in <module>
    load_entry_point('pep8ify==0.0.12', 'console_scripts', 'pep8ify')()
  File "/usr/local/lib/python2.7/dist-packages/pep8ify/pep8ify.py", line 17, in _main
    raise SystemExit(lib2to3.main.main("pep8ify.fixes"))
  File "/usr/lib/python2.7/lib2to3/main.py", line 260, in main
    options.processes)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 706, in refactor
    items, write, doctests_only)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 299, in refactor
    self.refactor_dir(dir_or_file, write, doctests_only)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 319, in refactor_dir
    self.refactor_file(fullname, write, doctests_only)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 747, in refactor_file
    *args, **kwargs)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 354, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 386, in refactor_string
    self.refactor_tree(tree, name)
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 426, in refactor_tree
    self.traverse_by(self.bmi_post_order_heads, tree.post_order())
  File "/usr/lib/python2.7/lib2to3/refactor.py", line 502, in traverse_by
    new = fixer.transform(node, results)
  File "/usr/local/lib/python2.7/dist-packages/pep8ify/fixes/fix_missing_whitespace.py", line 31, in transform
    new_prefix = " %s" % next_sibling.prefix.lstrip(' \t')
AttributeError: 'NoneType' object has no attribute 'prefix'
spulec commented 10 years ago

I think this is fixed in master with https://github.com/spulec/pep8ify/commit/54ceb96149ddb56b42bbc4bb2848a6849cd87855. Can you confirm?

giampaolo commented 10 years ago

Yes, I confirm latest code no longer has this issue.

spulec commented 10 years ago

Cool, I just pushed 0.0.13 to PyPI.