Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

1.3, 1.3.1 fail if HOME not in environment. #125

Closed
spazm opened this Issue · 1 comment

2 participants

@spazm

This was introduced with pull 22 and fixed by the changes for issue 95.

Strangely enough, my jenkins build doesn't get a HOME entry in its environment. Documenting in case someone else hits the same issue.

(perrylib_ve)[vm53@vm53] 1179% echo $HOME
/home/vm53
(perrylib_ve)[vm53@vm53] 1180% pep8 --version
1.3
(perrylib_ve)[vm53@vm53] 1229% pep8 --version
Traceback (most recent call last):
  File "/home/vm53/src/austin/perrylib/perrylib_ve/bin/pep8", line 8, in <module>
    load_entry_point('pep8==1.3', 'console_scripts', 'pep8')()
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/pkg_resources.py", line 318, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/pkg_resources.py", line 2221, in load_entry_point
    return ep.load()
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/pep8.py", line 118, in <module>
    os.path.join(os.getenv("HOME"), ".config"), "pep8")
  File "/home/vm53/src/austin/perrylib/perrylib_ve/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

(perrylib_ve)[vm53@vm53] 1179% echo $HOME
/home/vm53
(perrylib_ve)[vm53@vm53] 1180% pep8 --version
1.3.1

(perrylib_ve)[vm53@vm53] 1181% unset HOME
(perrylib_ve)[vm53@vm53] 1182% pep8 --version
Traceback (most recent call last):
  File "/home/vm53/src/austin/perrylib/perrylib_ve/bin/pep8", line 9, in <module>
    load_entry_point('pep8==1.3.1', 'console_scripts', 'pep8')()
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point
    """Locate distribution `dist_spec` and run its `script_name` script"""
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2221, in load_entry_point
    for line in self.get_metadata_lines(name):
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
    """
  File "/home/vm53/src/austin/perrylib/perrylib_ve/local/lib/python2.7/site-packages/pep8.py", line 117, in <module>
    os.path.join(os.getenv("HOME"), ".config"), "pep8")
  File "/home/vm53/src/austin/perrylib/perrylib_ve/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

(perrylib_ve)[vm53@vm53] 1221% unset HOME
(perrylib_ve)[vm53@vm53] 1222% pep8 --version
1.3.2
@spazm spazm closed this
@sigmavirus24

I wonder if amending that logic to use something like

os.path.join(os.environ('HOME', './'), ...)

Would be a better idea. That would prevent a bizarre error like this entirely. Or you could even just make it default to an empty string.

Edit Somehow I skipped over the beginning of your message mentioning that this was already fixed. Whoops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.