anaconda icon indicating copy to clipboard operation
anaconda copied to clipboard

Import Validation falsely detects conditional imports as not installed

Open autumnjolitz opened this issue 7 years ago • 0 comments

Expected Behaviour

Import validator detects the conditional import as not found only if it is actually not found.

Actual Behaviour

Import validator detects conditional import as a not found when it should be found. In the example, I use the stdlib abc module as a conditional import to demonstrate. abc is present in nearly every standard Python 3 installation out there.

Steps to Reproduce

  1. Setup a test sublime project with the following settings (put in your python3.6 installation, I use virtualenvs) and open it.
{
	"settings":
	{
		"anaconda_linting": true,
		"anaconda_linting_behaviour": "always",
		"python_interpreter": "~/.virtualenvs/cpython36/bin/python3.6",
		"validate_imports": true
	}
}
  1. Create a test.py file with:
try:
    import abc
except ImportError:
    'never happens'
else:
    abc = None
  1. Observe: screen shot 2018-03-16 at 3 43 23 pm

ST3, Anaconda and OS versions

  • ST3, Build 3143
  • Anaconda 2.1.26
  • OSX 16.7.0

ST3 Console Logs

reloading /Users/BenJolitz/software/geotools/test.sublime-project

Anaconda's JsonServer Logs

https://gist.github.com/benjolitz/6fcc73bd69a342a2d72cfc9cd437a2d6

autumnjolitz avatar Mar 16 '18 22:03 autumnjolitz