Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve unresolved import in VSCode?

I am trying to learn Flask, I use Ubuntu 19.04 and I am writing code in VSCode. After following the attached tutorial, I keep having the problem: unresolved import"flask_mysqldb" and the same with wtforms and passlib.

I have installed all requirements, and just to check, I try to install again and I receive the message:'Requirement already satisfied: mysqlclient in "someplace"/.local/lib/python2.7/site-packages

I thought that maybe I am using python 3.7 but it installs itself in 2.7? But it never asked me where to install.

This is the video tutorial I am following: https://www.youtube.com/watch?v=addnlzdSQs4

from flask import Flask, render_template, flash, redirect, url_for, session, loggin
from data import Articles
from flask_mysqldb import MySQL
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from passlib.hash import sha256_crypt

the first two imports work just fine, the others are underlined with green and receive error messages.

ex:

unresolved import 'flask_mysqldb'

unresolved import 'wtforms'

unresolved import 'passlib.hash'

like image 589
Max Avatar asked Apr 21 '19 14:04

Max


1 Answers

I have had this problem several times and it often works with just "exiting" VSCode since VSCode sometimes doesnt check the path. It uses the "old" settings or "path". By exiting the program and restarting it it updates this and it works (if its this problem)

like image 166
MrBrunotte Avatar answered Oct 10 '22 05:10

MrBrunotte