1
00:00:00,000 --> 00:00:14,320
So, to start with, I'm creating the virtual environment directory using mkdir hello underscore

2
00:00:14,320 --> 00:00:29,879
env and then cd hello underscore env and python3 minus mvenv, that will create a directory

3
00:00:29,879 --> 00:00:33,119
structure that is needed for the virtual environment.

4
00:00:33,119 --> 00:00:38,639
As you can see, the venv directory and the three commands reveals all the things that

5
00:00:38,639 --> 00:00:40,599
are within.

6
00:00:40,599 --> 00:00:45,480
So now the important thing is to source the virtual environment using source venv slash

7
00:00:45,480 --> 00:00:48,639
bin slash activate.

8
00:00:48,639 --> 00:00:52,020
And now we can install the required module.

9
00:00:52,020 --> 00:00:56,799
So pip install colorama.

10
00:00:56,799 --> 00:00:58,759
And oh, new version is available.

11
00:00:58,759 --> 00:01:01,119
Well, we don't need a new version.

12
00:01:01,119 --> 00:01:06,360
Feel free to use pip install minus minus upgrade pip to install the newer version of pip.

13
00:01:06,360 --> 00:01:08,419
But for now, we're good.

14
00:01:08,419 --> 00:01:16,000
Then I'm going to freeze the current requirements that have been used in requirements.txt.

15
00:01:16,000 --> 00:01:18,839
And now it's time to write the script.

16
00:01:18,839 --> 00:01:26,760
Okay, so let's create the script and call it myscript.py.

17
00:01:26,760 --> 00:01:34,559
And in the script, as a comment, I'm keeping the name myscript.py.

18
00:01:34,559 --> 00:01:39,839
And then I'm starting by importing date time.

19
00:01:39,839 --> 00:01:47,919
And from Colorama, which we just installed, import for.

20
00:01:47,919 --> 00:01:50,040
So here we have an import of two functions.

21
00:01:50,040 --> 00:01:51,519
One of them is an internal one.

22
00:01:51,519 --> 00:01:54,680
The other one is coming from the module.

23
00:01:54,680 --> 00:01:58,120
And now I'm defining the variable now.

24
00:01:58,120 --> 00:02:06,400
And now it's set to date time dot date time dot now.

25
00:02:06,400 --> 00:02:09,880
Close it with opening and closing parentheses.

26
00:02:09,880 --> 00:02:20,639
And then we can have the core of the script, which is using print for dot green plus f

27
00:02:20,639 --> 00:02:24,080
current time colon now.

28
00:02:24,080 --> 00:02:30,600
And I'm going to make a small typo so that you can see what is going on if you have typos.

29
00:02:30,600 --> 00:02:36,479
So let's try to run it using Python on myscript.py.

30
00:02:36,479 --> 00:02:41,279
And as you can see, Python is telling that something is not all right.

31
00:02:41,279 --> 00:02:46,199
It's telling us that the not all right is on the closing double quote.

32
00:02:46,199 --> 00:02:48,119
So that's easy to fix.

33
00:02:48,119 --> 00:02:53,259
And obviously, the closing double quote needs to be behind and not in front of the closing

34
00:02:53,339 --> 00:02:54,899
parentheses.

35
00:02:54,899 --> 00:02:56,259
So here we run it again.

36
00:02:56,259 --> 00:03:01,139
And there we can see that in nice green color, it prints the current date and time.

37
00:03:01,139 --> 00:03:04,460
And that concludes our simple lab exercise.

