Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97400

How to fix ModuleNotFoundError in python with Visual Studio Code

$
0
0

I'm developing a basic manager of students' degrees for learning Python, also I'm coding in VS Code and with python 3.7.3 enviroment.

I have created a package named clases inside of which are __init__.py and NotaParcial.py files, inside NotaParcial.py is just one class named NotaParcial too.

The problem appears when I try to use the class from other package using the syntax form clases.NotaParcial import *

I have tried already put an __init__.py file in the package.

The error message is:

Exception has occurred: ModuleNotFoundError No module named 'clases'
File "C:\Users\Usuario\OneDrive\Ingenieria\Semestre 3\Parcial 1\Modelamiento de software\Tareas\PySAcademico\prueba\prueba.py", line 1, in from clases.moduloNotaParcial import NotaParcial File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37\Lib\runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname)

I've tried to call the class from a file located in a superior path of the package and it works. I've tried use Visual Studio 2017 Community to repeat the process and in that IDE, it works and the problem doesn't appear.


Viewing all articles
Browse latest Browse all 97400

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>