Skip to content

Commit

Permalink
warn about invalid python prefix data, instead of erroring out
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Nov 8, 2018
1 parent 1471f04 commit a4ebc45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions conda/core/prefix_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import listdir
from os.path import basename, isdir, isfile, join, lexists

from .._vendor.auxlib.exceptions import ValidationError
from ..base.constants import CONDA_TARBALL_EXTENSION, PREFIX_MAGIC_FILE
from ..base.context import context
from ..common.compat import JSONDecodeError, itervalues, odict, string_types, with_metaclass
Expand Down Expand Up @@ -257,6 +258,16 @@ def _load_site_packages(self):
python_record = read_python_record(self.prefix_path, af, python_pkg_record.version)
except EnvironmentError:
continue
except ValidationError:
import sys
exc_type, exc_value, exc_traceback = sys.exc_info()
import traceback
tb = traceback.format_exception(exc_type, exc_value, exc_traceback)
log.warn("Problem reading non-conda package record at %s. Please verify that you "
"still need this, and if so, that this is still installed correctly. "
"Reinstalling this package may help.", af)
log.debug("ValidationError: \n%s\n", "\n".join(tb))
continue
if not python_record:
continue
self.__prefix_records[python_record.name] = python_record
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exclude = build/*,.tox/*,env/*,test_data/*,tests/*,ve/*,utils/*,*/_vendor/*,cond
[flake8]
max-line-length = 99
ignore = E126,E133,E226,E241,E242,E302,E704,E731,E722,W503
exclude = build/*,.tox/*,devenv/*,env/*,test_data/*,tests/*,ve/*,utils/*,*/_vendor/*,conda/compat.py,conda/common/compat.py,conda_env/compat.py
exclude = .asv*,build/*,.tox/*,devenv/*,env/*,test_data/*,tests/*,ve/*,utils/*,*/_vendor/*,conda/compat.py,conda/common/compat.py,conda_env/compat.py


[coverage:report]
Expand Down

0 comments on commit a4ebc45

Please sign in to comment.