First time here? Check out the FAQ!

Most imports suddenly failing

Most (not all) imports are suddenly failing when run in the wingware/pro ide (v6). Imports of both library modules (e.g., math) and of my own modules from within the current directory fail in the same way:


def _get_module_lock(name): """Get or create the module lock for a given module name.

Acquire/release internally the global import lock to protect

        lock = _module_locks[name]()   <======== raises KeyError.
    except KeyError:
        lock = None

All of the affected programs run just find outside the IDE, no import problems.

This seems to have started after I installed pylint and mypy but uninstalling these didn't clear the problem. sys.pythonpath appears correct.

What on earth is going on?

jeff sl's avatar
jeff sl
asked 2019-07-24 15:38:50 -0500
Wingware Support's avatar
Wingware Support
updated 2019-07-24 21:33:01 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


This KeyError is raised and then caught on the next line (except KeyError:). You shouldn't be seeing it unless you're stepping through the code or have set Wing up to always stop at KeyError exceptions.

Wingware Support's avatar
Wingware Support
answered 2019-07-25 08:49:33 -0500
edit flag offensive 0 remove flag delete link


Exception reporting is configured in the Debugger > Exceptions preferences page. Maybe you have Report Exceptions set to Always Immediately?

Wingware Support's avatar Wingware Support (2019-07-25 10:13:07 -0500) edit

Yup -- that's it. Exceptions set to Always Immediately produces an avalanche of exceptions at startup and beyond. And it appears that the python runtime produces exceptions in normal exection. So this brings up a follow-on question: is there a use case for which this feature is practical? What is the scope of the "Ignore this exception location" on the exceptions tool? Is it remembered for the project (and saved/restored with it)? Global for the user?

jeff sl's avatar jeff sl (2019-07-28 10:33:30 -0500) edit

It's only rarely useful at this point, during short sections of a run to get an idea of what exceptions are being raised in an implementation. I've rarely found it helpful and have wondered if we shouldn't just remove the feature, but it's been there for 20 years and there may be people that use it.

Ignored exceptions are stored in the project in the per-user/host branch of the project file (the .wpu that typically is not checked into revision control or shared with other users/machines).

Wingware Support's avatar Wingware Support (2019-07-29 20:57:01 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer