Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import 'azure.functions' pylint(import-error) [3,1] and Unable to import '__app__modules.library_finder' pylint(import-error) [4,1]

I'm trying to test out a serverless Python Chatbot API in Microsoft Azure, but when I follow online guide https://towardsdatascience.com/creating-a-serverless-python-chatbot-api-in-microsoft-azure-from-scratch-in-9-easy-steps-2f1913fc9581

it gives these error : Unable to import 'azure.functions' pylint(import-error) [3,1] Unable to import '__app__modules.library_finder' pylint(import-error) [4,1]

any idea how to resolve this?

Regards

like image 941
sirimiri Avatar asked Mar 28 '20 07:03

sirimiri


People also ask

How do I fix Pylint import error in Vscode?

Go to Command Palette using Ctrl + Shift + P. select python:select interpreter and then choose your appropriate virtualenv. The identical problem Pylint Import Error can be fixed by employing an alternative method, which will be discussed in more detail along with some code samples below.

What is azure function?

Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.


1 Answers

This error is coming from pylint. It seems that the linter is not pointed to the .env and therefore cannot validate the azure package! To solve it, you can try this:

In Visual Studio Code:

  • Locate the Python version in the status bar and click on it
  • Select the Azure workspace where your project resides
  • A list of Python versions show up for you. Pick the one that starts with ./.venv/ (In my case, it is: ./.venv/bin/python)
  • You might then get a popup saying the Linter pylint is not installed.
  • Click on Install button to install it and you should be good to go

Hope this helps

like image 96
Salem Artin Avatar answered Oct 16 '22 21:10

Salem Artin