Vscode-python: Exception has occurred: ModuleNotFoundError

Created on 10 Jun 2020  路  5Comments  路  Source: microsoft/vscode-python

maybe related to #12264

Environment data

  • VS Code version: 1.45.1
  • Extension version (available under the Extensions sidebar): 2020.5.2 (8 June 2020)
  • OS and version: Window 10 Version 1909 (OS Build 18363.836)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv

Expected behaviour

I am using vscode debugger as usual. But since yesterday, me and my coworkers started getting Exception has occurred: ModuleNotFoundError.

Actual behaviour

I started getting Exception has occurred: ModuleNotFoundError since around yesterday noon. I notice that that time coincide new version release time. https://github.com/microsoft/vscode-python/releases/tag/2020.5.86398

module_not_found

Steps to reproduce:

importerrorsimple

I extracted simple code to reproduce. Simple try except import can be used to reproduce error.

type-bug

Most helpful comment

This is microsoft/debugpy#281

The bug is that the exception is reported incorrectly when it shouldn't be, but it doesn't actually break your app - if you press F5, it should continue running. To prevent it from being reported, uncheck "User-Unhandled Exceptions" in the Breakpoints pane in bottom left.

(You shouldn't need to uncheck "Unhandled Exceptions".)

All 5 comments

As a temporary fix for those who are having similar problems, I removed the following ticks and solved the problem for now.

tempfix

Same here... If you install the previous version: [email protected] it's work. But is not the best way to solve it.

This is microsoft/debugpy#281

The bug is that the exception is reported incorrectly when it shouldn't be, but it doesn't actually break your app - if you press F5, it should continue running. To prevent it from being reported, uncheck "User-Unhandled Exceptions" in the Breakpoints pane in bottom left.

(You shouldn't need to uncheck "Unhandled Exceptions".)

This issue is also affecting Azure Functions Python function app.

Related Issues:
Python Worker grpc_tools not found: https://github.com/Azure/azure-functions-python-worker/issues/690
Azure Functions Core Tools for function app debug: https://github.com/Azure/azure-functions-core-tools/issues/2026

Since we have an issue tracking it in the debugpy repo, I'm going to close this one.

Note that the default for this setting has been changed, so nobody on the current version of the extension should be hitting this for new workspaces. However, the set checkbox may be checked in existing workspaces, in which case it would need to be unchecked manually.

Was this page helpful?
0 / 5 - 0 ratings