Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pep8ify crashes on simple input #17

Closed
alex opened this issue Jan 21, 2014 · 2 comments
Closed

pep8ify crashes on simple input #17

alex opened this issue Jan 21, 2014 · 2 comments

Comments

@alex
Copy link

alex commented Jan 21, 2014

Here's the code:

# Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals

import psycopg2cffi.compat

from warehouse.__about__ import (
    __title__, __summary__, __uri__, __version__, __author__, __email__,
    __license__, __copyright__, __build__,
)

__all__ = [
    "__title__", "__summary__", "__uri__", "__version__", "__author__",
    "__email__", "__license__", "__copyright__", "__build__",
]


psycopg2cffi.compat.register()

And the traceback:

$ pep8ify warehouse/__init__.py
RefactoringTool: Skipping implicit fixer: maximum_line_length
Traceback (most recent call last):
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/bin/pep8ify", line 9, in <module>
    load_entry_point('pep8ify==0.0.10', 'console_scripts', 'pep8ify')()
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/pep8ify.py", line 12, in _main
    sys.exit(main("pep8ify.fixes"))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/main.py", line 260, in main
    options.processes)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 706, in refactor
    items, write, doctests_only)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 301, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 747, in refactor_file
    *args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 354, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 386, in refactor_string
    self.refactor_tree(tree, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 426, in refactor_tree
    self.traverse_by(self.bmi_post_order_heads, tree.post_order())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib2to3/refactor.py", line 500, in traverse_by
    results = fixer.match(node)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 36, in match
    prev_node = get_previous_node(node)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 12, in get_previous_node
    return get_previous_node(node.parent)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 12, in get_previous_node
    return get_previous_node(node.parent)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 12, in get_previous_node
    return get_previous_node(node.parent)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 12, in get_previous_node
    return get_previous_node(node.parent)
  File "/Users/alex_gaynor/.virtualenvs/tempenv-6c9a3044561e1/lib/python2.7/site-packages/pep8ify/fixes/fix_whitespace_before_inline_comment.py", line 10, in get_previous_node
    if node.prev_sibling:
AttributeError: 'NoneType' object has no attribute 'prev_sibling'
@spulec spulec closed this as completed in f581fe1 Jan 21, 2014
@spulec
Copy link
Owner

spulec commented Jan 21, 2014

Thanks! Sorry for the issues lately.

@alex
Copy link
Author

alex commented Jan 21, 2014

No problem, thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants