question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import email.mime with Python (v3.6) Azure Function v2

See original GitHub issue

From @chisqrd on February 14, 2019 20:4

I cannot seem to email from an python azure function on linux consumption plan. I created a function with Visual Studio Code and it does locally run fine.

requirements.txt has the following

azure-functions==1.0.0b3 azure-functions-worker==1.0.0b3 grpcio==1.14.2 grpcio-tools==1.14.2 protobuf==3.6.1 six==1.12.0 psycopg2==2.7.6.1 azure-keyvault azure-common

Where it errors out is from email.mime.multipart import MIMEMultipart though I did verify right before that email package was in sys.modules.

The error I get is the following

2019-02-14T17:46:30.945 [Error] An error occurred: No module named ‘email.mime’

Is this a known issue or am i missing something?

Copied from original issue: Azure/Azure-Functions#1129

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ankitkumarrcommented, Feb 21, 2019

Apologies for the delay here. I was able to reproduce this issue. You can mitigate it by using the --no-bundler flag while publishing. So, you can use func azure functionapp publish <appname> --build-native-deps --no-bundler.

We are working on improving our publishing pipeline through platform changes. Until then, please continue to use that flag if you experience issues with certain modules.

Using that flag, you may see some performance decrease (longer cold start). Additional details on the flag can be found here.

Let me know if you continue to see issues after using that flag.

2reactions
CommonCrisiscommented, Feb 21, 2019

Same issue! Just to prevent this question: No, no file is or was called email.py.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Python errors in Azure Functions - Microsoft Learn
Here are the troubleshooting sections for common issues in Python functions: ModuleNotFoundError and ImportError; Cannot import 'cygrpc'; Python ...
Read more >
ImportError: No module named 'email.mime'; email is not a ...
I encountered the same problem just now. Finally, I found it's because I name the python file as 'email.py'. It works after changing...
Read more >
email.mime: Creating email and MIME objects from scratch ...
Source code: Lib/email/mime/ This module is part of the legacy ( Compat32) email API. Its functionality is partially replaced by the contentmanager in...
Read more >
Python 3 - Sending Email using SMTP - Tutorialspoint
Python provides smtplib module, which defines an SMTP client session object that can be used to send mails to any Internet machine with...
Read more >
Developing and deploying a Python Azure Function - Medium
I have been working with C# Azure Functions for a quite a while now. ... Step 3 — Debugging the Python function using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found