WEBVTT

00:00.050 --> 00:03.950
To be able to send an email from the Raspberry Pi with Python.

00:03.950 --> 00:10.130
We are going to use a Python module, and the module that we will use for this course is called Jag

00:10.130 --> 00:10.910
mail.

00:11.120 --> 00:17.990
So what you can do, for example, is you open a shell here in the terminal and you can do import jag

00:17.990 --> 00:18.320
mail.

00:18.320 --> 00:20.570
So y a and then g mail.

00:21.230 --> 00:22.760
And you should see this.

00:22.760 --> 00:23.750
So I press enter.

00:23.750 --> 00:25.460
You should see an error okay.

00:25.490 --> 00:31.790
Module not found error because well this is not part of the core modules that are already built in with

00:31.790 --> 00:32.360
Python.

00:32.360 --> 00:35.540
This is an external module you have to install by yourself.

00:35.540 --> 00:38.810
So the first thing I want to show you we're not going to use that.

00:38.810 --> 00:47.120
But if you go on tools here in Thonny and manage packages then here you can search for Jag mail okay.

00:47.150 --> 00:48.290
Click on search.

00:48.830 --> 00:51.770
You will find this one here okay.

00:51.800 --> 00:53.600
And you might try to install it from here.

00:53.600 --> 00:57.050
But you will see you will get an error okay.

00:57.080 --> 00:58.730
So we're going to get the same error in the terminal.

00:58.730 --> 01:01.250
I'm going to explain to you how to fix that.

01:01.790 --> 01:03.740
So let's go to the terminal.

01:03.770 --> 01:09.770
Let's install the module from the terminal instead I'm going to do clear here and how to install a Python

01:09.770 --> 01:10.130
module.

01:10.130 --> 01:13.220
Well you have the pip three command.

01:13.220 --> 01:16.100
And you also have the sudo apt install.

01:16.100 --> 01:19.670
And then you can do Python three dash the module name.

01:19.670 --> 01:21.470
The thing is jag mail.

01:21.890 --> 01:27.110
So if I do YAML jagmal here, Jagmal is actually not available with apt here.

01:27.110 --> 01:31.010
So sometimes it's the case and you cannot install it with apt.

01:31.220 --> 01:34.340
Okay, that would be the best choice, but it's not available.

01:34.340 --> 01:43.520
So we are going to use Pip3 install and then Jagmal I press enter and you see we have an error here.

01:43.520 --> 01:46.310
So if you don't have an error if it works then all fine.

01:46.310 --> 01:53.210
But you might have this error that says that the environment is externally managed, etc. etc. and if

01:53.210 --> 02:00.170
you remember, I showed you this error before and you can add this, you can add brake system packages.

02:00.170 --> 02:03.230
So you add this option after the command.

02:03.230 --> 02:06.140
So here I'm going to use the up arrow key to come back to the command.

02:06.140 --> 02:07.100
And then space.

02:07.100 --> 02:16.460
And I'm going to type this brake system packages okay I press enter.

02:17.330 --> 02:19.220
And now you see it is going to work.

02:19.220 --> 02:22.370
So it's going to download stuff and install stuff okay.

02:22.400 --> 02:22.670
Here.

02:22.670 --> 02:25.310
Well actually I already installed an uninstall it before.

02:25.310 --> 02:26.360
So it's using the cache.

02:26.360 --> 02:31.700
But for you it's going to download some stuff and you see successfully installed Jagmal.

02:31.700 --> 02:39.380
So if I go back here and if I use the up arrow to import Jagmal again, you see that now it's working

02:39.380 --> 02:41.150
because we don't have any error.

02:41.180 --> 02:41.690
Great.

02:41.690 --> 02:45.920
And now that we have installed this module we can use its functionalities.
