Ask Your Question
1

Most imports suddenly failing

asked 2019-07-24 15:38:50 -0500

jeff sl gravatar image

updated 2019-07-24 21:33:01 -0500

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:

In _bootstrap.py:

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
_module_locks."""

_imp.acquire_lock()
try:
    try:
        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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-25 08:49:33 -0500

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.

edit flag offensive delete link more

Comments

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

Wingware Support gravatar imageWingware 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 gravatar imagejeff 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 gravatar imageWingware Support ( 2019-07-29 20:57:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-07-24 15:38:50 -0500

Seen: 64 times

Last updated: Jul 24