1
00:00:00,000 --> 00:00:04,990
As we start the Python Quick Start, we're going to use the traditional

2
00:00:05,000 --> 00:00:06,990
"Hello, World!" program.

3
00:00:07,000 --> 00:00:12,990
And purpose of "Hello, World!" is not an exercise to find the simplest form of

4
00:00:13,000 --> 00:00:15,990
code in a particular language, or anything like that.

5
00:00:16,000 --> 00:00:18,990
It's actually to learn about the development environment, to learn about what we

6
00:00:19,000 --> 00:00:20,990
call the development cycle:

7
00:00:21,000 --> 00:00:27,990
what it takes to edit, and to test, and to change, and to test and to run code

8
00:00:28,000 --> 00:00:29,990
in a particular environment.

9
00:00:30,000 --> 00:00:34,990
And so for this purpose we use the simplest form of a program itself, so that

10
00:00:35,000 --> 00:00:37,990
that can get out of the way and then we can focus on the environment.

11
00:00:38,000 --> 00:00:41,990
In this case, I've this up here on the screen in Eclipse.

12
00:00:42,000 --> 00:00:44,990
And this is Eclipse using Pydev, which is a Python development environment that

13
00:00:45,000 --> 00:00:46,990
runs inside of Eclipse.

14
00:00:47,000 --> 00:00:50,990
Eclipse is an integrated development environment originally written for

15
00:00:51,000 --> 00:00:53,990
developing in Java, but it has plug- ins for a lot of different languages.

16
00:00:54,000 --> 00:00:59,990
And Pydev is actually a pretty good plug-in for the Python language.

17
00:01:00,000 --> 00:01:01,990
And so, we'll be using this throughout this course.

18
00:01:02,000 --> 00:01:06,990
You do not have to use Eclipse, and if you have some other development

19
00:01:07,000 --> 00:01:11,990
environment that you prefer, or you just want to use an editor and a command line,

20
00:01:12,000 --> 00:01:12,990
that's perfectly fine.

21
00:01:13,000 --> 00:01:16,990
You can do all of the exercises; you do not need to use Eclipse.

22
00:01:17,000 --> 00:01:21,990
The reason that I'm using Eclipse is because it's convenient for the purpose of teaching.

23
00:01:22,000 --> 00:01:23,990
I've got everything that I need right up here on the screen.

24
00:01:24,000 --> 00:01:28,990
I can run code, I get the results of code, and it works well for the purpose of

25
00:01:29,000 --> 00:01:32,990
teaching, but you don't need to use it for your development work.

26
00:01:33,000 --> 00:01:36,990
And you do not need to use it to follow along in the exercises.

27
00:01:37,000 --> 00:01:39,990
In Eclipse, if I want to run this Hello, World!,

28
00:01:40,000 --> 00:01:44,990
I simply click on this Run button up here, and it'll ask me, How I want to run it?

29
00:01:45,000 --> 00:01:46,990
and I'm going to select Python Run.

30
00:01:47,000 --> 00:01:48,990
I only need to do this the first time I run a script.

31
00:01:49,000 --> 00:01:51,990
So I'm going to say OK.

32
00:01:52,000 --> 00:01:55,990
And here we have the result down here: "Hello, World!"

33
00:01:56,000 --> 00:01:59,990
If I were running this in another environment and I actually have this script

34
00:02:00,000 --> 00:02:01,990
loaded up here on a Unix Server -

35
00:02:02,000 --> 00:02:03,990
this is my Unix Server -

36
00:02:04,000 --> 00:02:08,990
there is the script, you see it's exactly the same.

37
00:02:09,000 --> 00:02:14,990
And if run it I say ./hello.py, and it runs it.

38
00:02:15,000 --> 00:02:18,990
An important part of this is this shebang line.

39
00:02:19,000 --> 00:02:22,990
If we look here in Eclipse, we see this shebang line here.

40
00:02:23,000 --> 00:02:27,990
In many environments, mostly Unix- based environments, but this includes

41
00:02:28,000 --> 00:02:31,990
Macintosh and it includes many, many web servers that are running Unix-based

42
00:02:32,000 --> 00:02:34,990
operating systems, like Linux or PSD,

43
00:02:35,000 --> 00:02:37,990
this shebang line is actually very important.

44
00:02:38,000 --> 00:02:41,990
It's called a shebang line because it's starts with a hash and then has an

45
00:02:42,000 --> 00:02:44,990
exclamation mark, which is sometimes called a bang.

46
00:02:45,000 --> 00:02:52,990
And then after that it has the path to the interpreter that will be used to run the script.

47
00:02:53,000 --> 00:02:57,990
When the script is executed and the shell sees it, it will look here for the

48
00:02:58,000 --> 00:03:00,990
interpreter and then use that to run the script.

49
00:03:01,000 --> 00:03:04,990
So sometimes you'll see a bash up here, or Perl, or something like that.

50
00:03:05,000 --> 00:03:09,990
And all that's doing is it's telling the shell to use that interpreter to run

51
00:03:10,000 --> 00:03:10,990
whatever script is there.

52
00:03:11,000 --> 00:03:13,990
For Python, it's going to be something like this.

53
00:03:14,000 --> 00:03:15,990
It might be #!/usr/bin/python3.

54
00:03:16,000 --> 00:03:20,990
It might be #!/usr/local/bin/python3.

55
00:03:21,000 --> 00:03:30,990
It might be #!/usr/bin/env python3, something like that.

56
00:03:31,000 --> 00:03:34,990
In this case, I'm using #!/usr/bin/python3 because I know that, that works in the

57
00:03:35,000 --> 00:03:36,990
environments that I'm using.

58
00:03:37,000 --> 00:03:39,990
And if it doesn't, then I'll make a symbolic link or something and make it work.

59
00:03:40,000 --> 00:03:41,990
So if you're running this on a Unix-based operating system,

60
00:03:42,000 --> 00:03:48,990
you'll want to do ls -l and look at the file permissions, and make sure that it has

61
00:03:49,000 --> 00:03:50,990
executable permissions.

62
00:03:51,000 --> 00:03:56,990
If it doesn't, you can make it executable by typing chmod, or as we pronounce it

63
00:03:57,000 --> 00:04:05,990
chmod 755, which makes it editable and executable for your user ID, and then

64
00:04:06,000 --> 00:04:07,990
the name of the file.

65
00:04:08,000 --> 00:04:09,990
And that will make it executable.

66
00:04:10,000 --> 00:04:15,990
And then you can execute it with ./ or however it is that you do that on your system.

67
00:04:16,000 --> 00:04:19,990
So that is the development environment that we will be using.

68
00:04:20,000 --> 00:04:22,990
For the most part, we're going to using Eclipse.

69
00:04:23,000 --> 00:04:25,990
And so we'll be running scripts like this.

70
00:04:26,000 --> 00:04:26,990
Save it and Run it.

71
00:04:27,000 --> 00:04:29,990
It'll run here in the Console.

72
00:04:30,000 --> 00:04:32,990
So you're going to want to take the opportunity, using this "Hello, World!"

73
00:04:33,000 --> 00:04:36,990
script, to learn about the development cycle and whatever environment you're

74
00:04:37,000 --> 00:04:41,990
using, especially if it's not Eclipse, to follow along with the exercises

75
00:04:42,000 --> 00:04:52,000
in this course.

