1
00:00:01,090 --> 00:00:06,550
Hey, Today I'll introduce you to a pretty cool service in relation to Python.

2
00:00:06,550 --> 00:00:07,840
And that is Python.

3
00:00:07,840 --> 00:00:08,540
Anywhere.

4
00:00:08,560 --> 00:00:17,050
Python Anywhere is a service which offers you a server, a computer which runs 24 seven, and you can

5
00:00:17,050 --> 00:00:25,180
use this computer to host web apps, but also to schedule tasks, to schedule Python scripts for execution

6
00:00:25,180 --> 00:00:27,280
at the particular time every day.

7
00:00:27,610 --> 00:00:34,000
So, for example, you can schedule a script which sends out an email at a certain time to a particular

8
00:00:34,000 --> 00:00:41,500
email address, and you can also have a script perhaps, which scrapes a value from a website, some

9
00:00:41,500 --> 00:00:42,780
data from websites.

10
00:00:42,790 --> 00:00:49,210
You can also schedule this script to be executed at a particular time every day, and you can have the

11
00:00:49,210 --> 00:00:54,490
script, store the data in text files inside the server, and later you can retrieve this data.

12
00:00:54,820 --> 00:00:58,780
So Python anywhere allows you to do that and I'll show you how to do it.

13
00:00:59,020 --> 00:01:03,640
So go to Python anywhere dot com and you need to sign up for an account.

14
00:01:05,600 --> 00:01:07,190
You have several options there.

15
00:01:07,190 --> 00:01:12,080
Both a beginner account which is free should do the job very well.

16
00:01:12,620 --> 00:01:19,760
So you should create a beginner account and once you do that you should go to the login menu and to

17
00:01:19,760 --> 00:01:22,210
login with your new account there.

18
00:01:22,800 --> 00:01:24,860
Then you want to go to the dashboard.

19
00:01:24,890 --> 00:01:30,110
That's where you have all the tools that you can use in Python anywhere.

20
00:01:30,140 --> 00:01:34,850
So now I'll take you through how to use Python anywhere and its features.

21
00:01:35,540 --> 00:01:43,760
So first of all, you might want to go to council's the council's menu and here you can see what is

22
00:01:43,760 --> 00:01:47,670
the latest version of Python that is supported by Python anywhere.

23
00:01:47,690 --> 00:01:51,110
In my case it is 3.10.

24
00:01:51,440 --> 00:01:59,060
Now, if you had created your account on Python anywhere earlier on a few months ago, perhaps a year

25
00:01:59,060 --> 00:02:04,070
ago, then the latest version might be 3.8 or something else.

26
00:02:04,460 --> 00:02:10,850
But if you create a new account, it could be 3.10 or 3.11, depending when you created that account.

27
00:02:11,390 --> 00:02:17,660
So that is something to keep in mind because we will use that version when we schedule tasks.

28
00:02:18,380 --> 00:02:24,810
So just remember the newest version for now and then go to files now in files.

29
00:02:24,830 --> 00:02:30,460
You will see some default files, but also files you have uploaded.

30
00:02:30,470 --> 00:02:35,630
So in your case, you haven't uploaded anything yet, but I have uploaded some files before for other

31
00:02:35,630 --> 00:02:38,750
projects, so you should see them here.

32
00:02:38,750 --> 00:02:42,140
So these are the files that are in your computer.

33
00:02:42,140 --> 00:02:47,720
So you basically have a computer here and this computer has python installed.

34
00:02:47,720 --> 00:02:50,480
And in this computer you can upload files.

35
00:02:50,480 --> 00:02:58,370
So this computer doesn't really have a graphical user interface and a graphical operating system as

36
00:02:58,370 --> 00:03:01,820
you do on Windows or Mac or Linux or both.

37
00:03:01,820 --> 00:03:09,650
You have this browser to do like basic tasks on these computers, such as uploading files, and you

38
00:03:09,650 --> 00:03:12,230
can open these files as well.

39
00:03:13,810 --> 00:03:15,370
To see what they contain.

40
00:03:18,420 --> 00:03:22,170
So in our case, since we want to schedule.

41
00:03:24,720 --> 00:03:25,920
Our main thoughts.

42
00:03:25,980 --> 00:03:31,110
People file for execution, so we want to execute the script at 8 a.m. in the morning.

43
00:03:31,110 --> 00:03:35,820
For example, when we want to upload the script to these files.

44
00:03:35,850 --> 00:03:39,120
Now I have uploaded it before, so I'll just delete it.

45
00:03:42,230 --> 00:03:44,930
And I'll play it again so that I show you how to do it.

46
00:03:44,960 --> 00:03:47,060
So just click on the upload file.

47
00:03:47,390 --> 00:03:48,800
Go to Main dot P.

48
00:03:48,860 --> 00:03:55,040
So you need to upload all the scripts of your project and that includes main dot pie, but also send

49
00:03:55,070 --> 00:03:56,240
email dot pie.

50
00:03:56,570 --> 00:04:04,580
So main that I was uploaded, then upload, sent, email, dot pie and that file should be listed here

51
00:04:04,580 --> 00:04:05,120
as well.

52
00:04:05,690 --> 00:04:11,990
So these files are uploaded in this directory, so please copy that directory.

53
00:04:14,920 --> 00:04:16,480
And then go to tusks.

54
00:04:17,570 --> 00:04:22,640
Now in tasks, I have a task which is already running, so I'll cancel it.

55
00:04:23,450 --> 00:04:25,610
So you should see something like this.

56
00:04:25,820 --> 00:04:32,120
Now, in here, you should paste that path and then make sure you have a slash here.

57
00:04:32,330 --> 00:04:33,890
Then write main dot P.

58
00:04:33,920 --> 00:04:38,840
So main dot p y is a script which contains my codes.

59
00:04:39,110 --> 00:04:41,720
So this is the entry point of the program.

60
00:04:42,530 --> 00:04:48,290
When I execute this program, I execute main dot P right in charm.

61
00:04:48,560 --> 00:04:52,100
So make sure that you point to that file in here.

62
00:04:52,520 --> 00:04:55,810
But you should also write before this path.

63
00:04:55,820 --> 00:04:57,320
You should write what?

64
00:04:57,320 --> 00:04:58,340
Interpreter What?

65
00:04:58,340 --> 00:05:01,800
Python interpreter Do you want to execute this file?

66
00:05:01,820 --> 00:05:06,800
So in my case, that would be Python 3.10 and space.

67
00:05:07,370 --> 00:05:11,780
So Python 3.10 space and then the path.

68
00:05:12,110 --> 00:05:16,730
In your case, it should be the latest version of Python that is supported by Python anywhere.

69
00:05:16,760 --> 00:05:18,980
That's why I showed you the concepts first.

70
00:05:18,980 --> 00:05:21,380
So you know what versions you have there.

71
00:05:22,100 --> 00:05:27,230
So what's happening here is that we're telling Python anywhere to run this command.

72
00:05:27,500 --> 00:05:34,730
So to run that script with that programming language at this particular time.

73
00:05:34,820 --> 00:05:42,380
So if you want to run this, let's say 2 minutes from now just to test it, then you might want to place

74
00:05:42,380 --> 00:05:43,490
your 17.

75
00:05:43,490 --> 00:05:47,480
In my case, the current server time is 1740.

76
00:05:48,080 --> 00:05:51,500
So I want to place it like 2 minutes after that.

77
00:05:52,130 --> 00:05:53,690
So the time is 42.

78
00:05:53,690 --> 00:05:54,020
Now.

79
00:05:54,020 --> 00:05:59,240
This should be around 1742 for now because it's not being refreshed.

80
00:05:59,510 --> 00:06:03,620
So I should place it something like 1744.

81
00:06:03,920 --> 00:06:04,310
Yeah.

82
00:06:05,510 --> 00:06:10,160
So it's about 2 minutes from now when present create.

83
00:06:12,150 --> 00:06:18,030
So this script will be executed at that time and it will be executed daily.

84
00:06:18,830 --> 00:06:25,400
So I should wait a few minutes and see if I receive an email to my email address.

85
00:06:27,590 --> 00:06:31,310
So it seems like I received a new email so that it is.

86
00:06:32,420 --> 00:06:39,980
If you didn't receive an email, you should go to the logs which you can access in here.

87
00:06:41,230 --> 00:06:43,300
So that should tell you what happened.

88
00:06:43,330 --> 00:06:47,830
Now, in my case, they say that the task was completed this time.

89
00:06:48,520 --> 00:06:51,940
So that was the time I schedule the task for execution.

90
00:06:52,390 --> 00:06:57,250
And in your case, perhaps you have some errors which could be displayed in here.

91
00:06:57,550 --> 00:07:06,100
Or sometimes you might have a message somewhere here which says that the python command was not found.

92
00:07:06,100 --> 00:07:12,790
So in that case, you should go back and check if your command is correctly.

93
00:07:12,790 --> 00:07:17,560
So in my case, it's Python 3.10, so I should check on consoles.

94
00:07:17,950 --> 00:07:20,590
3.10 is a correct command.

95
00:07:20,590 --> 00:07:22,300
So for me it's fine.

96
00:07:24,270 --> 00:07:30,720
So make sure you don't have spaces in this command, but you have a space between that command and the

97
00:07:30,720 --> 00:07:31,320
path.

98
00:07:32,040 --> 00:07:38,370
Or you might have errors underneath here which are errors produced by the Python script.

99
00:07:38,370 --> 00:07:44,700
So these are the same errors you might be getting in the pie charm command line.

100
00:07:44,700 --> 00:07:49,350
So if your code has an issue, that error will be displayed here as well.

101
00:07:50,460 --> 00:07:52,470
So that's something to keep in mind.

102
00:07:52,470 --> 00:07:57,900
And yeah, that's how you schedule tasks for execution in Python anywhere.

103
00:07:58,140 --> 00:08:05,430
So Python Anywhere has the task feature that the main feature of Python anywhere, but also it has a

104
00:08:05,430 --> 00:08:06,780
web feature here.

105
00:08:06,780 --> 00:08:09,000
You can host web apps.

106
00:08:09,240 --> 00:08:16,560
So previously in the course we use the Heroku servers to host our stream lit app or but you can also

107
00:08:16,560 --> 00:08:19,290
use Python anywhere to host certain apps.

108
00:08:19,320 --> 00:08:26,730
However, Python anywhere does not work with stream apps, so you cannot host streaming apps on python

109
00:08:26,730 --> 00:08:27,360
anywhere.

110
00:08:27,810 --> 00:08:33,120
For a list of apps you can host, you can click on next and you can see them in here.

111
00:08:34,070 --> 00:08:37,400
So Django Web two Pie Flask bottle.

112
00:08:37,490 --> 00:08:42,740
These are web frameworks, Python Web frameworks used to build web apps.

113
00:08:43,580 --> 00:08:47,240
So we're not going to use Python anywhere for Web apps for now.

114
00:08:47,900 --> 00:08:50,570
And so what I wanted to show you was this.

115
00:08:50,570 --> 00:08:53,120
That's how you can schedule tasks.

116
00:08:54,130 --> 00:08:55,030
Another feature.

117
00:08:55,030 --> 00:09:01,810
Also, if you go to consoles, you can open a python shell by clicking one of those versions and that

118
00:09:01,810 --> 00:09:08,410
should display an interactive python shell for you on the browser where you can code.

119
00:09:11,390 --> 00:09:12,340
So there you go.

120
00:09:12,350 --> 00:09:15,740
That's Python 3.10 point five in my case.

121
00:09:15,740 --> 00:09:17,150
And you can code here.

122
00:09:17,480 --> 00:09:23,030
But of course, this is an interactive shell, so the code will not be saved in this console.

123
00:09:23,060 --> 00:09:29,630
To go back to the dashboard, you can click there and go to dashboard and the console is still open

124
00:09:29,630 --> 00:09:29,900
there.

125
00:09:29,900 --> 00:09:35,900
So you can press there and you can access the same code you wrote earlier.

126
00:09:38,070 --> 00:09:40,170
So that's about Python anywhere.

127
00:09:40,350 --> 00:09:42,530
Thanks for following and I'll talk to you later.

