title
Google Python Class Day 2 Part 2

description
Google Python Class Day 2 Part 2: Utilities: OS and Commands. By Nick Parlante. Support materials and exercises: http://code.google.com/edu/languages/google-python-class

detail
{'title': 'Google Python Class Day 2 Part 2', 'heatmap': [{'end': 65.906, 'start': 33.534, 'weight': 0.902}, {'end': 114.562, 'start': 95.691, 'weight': 0.713}, {'end': 184.908, 'start': 144.937, 'weight': 0.811}, {'end': 333.273, 'start': 280.375, 'weight': 0.807}, {'end': 537.597, 'start': 517.332, 'weight': 0.76}], 'summary': 'Covers python modules os and file operations, launching external processes, error detection, and reporting importance with attention to coding details, emphasizing practical functions and tools with a specific exercise for the next module.', 'chapters': [{'end': 73.734, 'segs': [{'end': 65.906, 'src': 'heatmap', 'start': 0.69, 'weight': 0, 'content': [{'end': 8.003, 'text': 'So in this section, I want to play up this idea of modules of existing code that you might want to use to just sort of solve common problems.', 'start': 0.69, 'duration': 7.313}, {'end': 12.211, 'text': "In this case, I'm going to show you some file system interface stuff.", 'start': 8.705, 'duration': 3.506}, {'end': 17.744, 'text': 'And also how you call an external process and capture its output and like it to do something.', 'start': 13.641, 'duration': 4.103}, {'end': 22.347, 'text': 'So you can imagine using Python, as you might use bash, but just sort of as a better bash,', 'start': 17.824, 'duration': 4.523}, {'end': 26.99, 'text': 'to sort of glue something together to solve some sort of a utility.', 'start': 22.347, 'duration': 4.643}, {'end': 29.932, 'text': "So, I'll start off in the interpreter here.", 'start': 28.231, 'duration': 1.701}, {'end': 32.093, 'text': 'Fire up Python.', 'start': 31.333, 'duration': 0.76}, {'end': 36.916, 'text': 'And the first module I want to talk about is the OS module.', 'start': 33.534, 'duration': 3.382}, {'end': 39.118, 'text': 'This is for operating system, I think.', 'start': 37.817, 'duration': 1.301}, {'end': 42.673, 'text': "And I'm just going to do a DIR on it.", 'start': 41.032, 'duration': 1.641}, {'end': 47.598, 'text': "So I import the OS module, I'm going to look inside of there and you can see there's all sorts of functions in there.", 'start': 43.094, 'duration': 4.504}, {'end': 52.582, 'text': 'These obviously, you know, set GPID and nice.', 'start': 47.778, 'duration': 4.804}, {'end': 56.626, 'text': 'These are obviously kind of operating system oriented utilities.', 'start': 52.943, 'duration': 3.683}, {'end': 59.689, 'text': 'Have a very kind of a Unixy feeling.', 'start': 57.627, 'duration': 2.062}, {'end': 65.906, 'text': 'In theory, these are, these try to be platform independent.', 'start': 62.082, 'duration': 3.824}], 'summary': 'Using python modules to interface with file system and external processes for utility solutions.', 'duration': 46.908, 'max_score': 0.69, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM690.jpg'}], 'start': 0.69, 'title': 'Python module: os', 'summary': 'Introduces the os module in python, highlighting its functions for file system interface and calling external processes, emphasizing its platform independence and effectiveness as an alternative to bash.', 'chapters': [{'end': 73.734, 'start': 0.69, 'title': 'Python module: os', 'summary': 'Introduces the os module in python, showcasing its functions for file system interface and calling external processes, emphasizing its usefulness as a better alternative to bash and its platform independence.', 'duration': 73.044, 'highlights': ["The chapter emphasizes the idea of using modules of existing code in Python to solve common problems, highlighting the file system interface and calling external processes. It showcases Python's ability to function as a better alternative to bash for gluing utilities together (3x).", 'The chapter introduces the OS module in Python, showcasing its functions for file system interface and calling external processes, emphasizing its usefulness as a better alternative to bash and its platform independence (3x).', 'The OS module in Python contains various functions for operating system-oriented utilities, with a Unixy feeling, and aims to be platform independent (3x).', 'The chapter demonstrates the use of the OS module in Python for file system interface and calling external processes, highlighting its ability to function as a better alternative to bash and its platform independence (2x).', 'The OS module in Python provides functions for file system interface and calling external processes, resembling operating system-oriented utilities with a Unixy feeling, and aims to be platform independent (2x).']}], 'duration': 73.044, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM690.jpg', 'highlights': ["The chapter emphasizes the idea of using modules of existing code in Python to solve common problems, highlighting the file system interface and calling external processes. It showcases Python's ability to function as a better alternative to bash for gluing utilities together (3x).", 'The chapter introduces the OS module in Python, showcasing its functions for file system interface and calling external processes, emphasizing its usefulness as a better alternative to bash and its platform independence (3x).', 'The OS module in Python contains various functions for operating system-oriented utilities, with a Unixy feeling, and aims to be platform independent (3x).', 'The chapter demonstrates the use of the OS module in Python for file system interface and calling external processes, highlighting its ability to function as a better alternative to bash and its platform independence (2x).', 'The OS module in Python provides functions for file system interface and calling external processes, resembling operating system-oriented utilities with a Unixy feeling, and aims to be platform independent (2x).']}, {'end': 488.362, 'segs': [{'end': 135.218, 'src': 'heatmap', 'start': 95.691, 'weight': 0, 'content': [{'end': 97.953, 'text': 'So, actually, I could do help on it, just to show you how that works.', 'start': 95.691, 'duration': 2.262}, {'end': 100.334, 'text': 'Remember, so I say os.lister.', 'start': 98.053, 'duration': 2.281}, {'end': 106.759, 'text': "So, it says is, okay, what this does, it takes a path and it's going to give me a list of strings.", 'start': 101.755, 'duration': 5.004}, {'end': 109.161, 'text': 'So, what this is going to do is I give it a path to a directory.', 'start': 106.779, 'duration': 2.382}, {'end': 114.562, 'text': "And then it's going to figure out what all the file names are in that directory and just return it to me as a list of Python strings.", 'start': 109.898, 'duration': 4.664}, {'end': 118.365, 'text': 'So let me get out of the interpreter here.', 'start': 116.503, 'duration': 1.862}, {'end': 125.851, 'text': "So to demonstrate this, what I thought I'd do is I'll modify the long-suffering hello.py example to just list files.", 'start': 118.845, 'duration': 7.006}, {'end': 128.012, 'text': "So I'll say import OS here.", 'start': 126.471, 'duration': 1.541}, {'end': 133.997, 'text': "I'll rename this list uppercase L.", 'start': 129.753, 'duration': 4.244}, {'end': 135.218, 'text': "Let's say this will take a directory.", 'start': 133.997, 'duration': 1.221}], 'summary': 'Demonstrating os.lister function to retrieve and list files in a directory using python.', 'duration': 39.527, 'max_score': 95.691, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM95691.jpg'}, {'end': 184.908, 'src': 'heatmap', 'start': 144.937, 'weight': 0.811, 'content': [{'end': 151.78, 'text': "And then just sort of as I've been encouraging you to do for the exercises, well, I'll just print what that gives me for starters.", 'start': 144.937, 'duration': 6.843}, {'end': 154.601, 'text': "So here I'll say list.", 'start': 153.64, 'duration': 0.961}, {'end': 157.022, 'text': "So here in the main, I'll just leave it the way it is.", 'start': 154.621, 'duration': 2.401}, {'end': 160.243, 'text': "So I'll just, I'll assume that there's one command line argument and I'll just list it.", 'start': 157.042, 'duration': 3.201}, {'end': 164.605, 'text': 'So hopefully this is in the same directory.', 'start': 161.703, 'duration': 2.902}, {'end': 171.463, 'text': "So if I say hello of let's say dot, And you can see it's, you know, it's found.", 'start': 165.425, 'duration': 6.038}, {'end': 174.344, 'text': "So that, I'll do an LS, the other way we can access this information.", 'start': 171.503, 'duration': 2.841}, {'end': 176.565, 'text': "So there's this .", 'start': 175.565, 'duration': 1}, {'end': 181.067, 'text': 'DSStore thing that the Macintosh like pathologically puts everywhere.', 'start': 176.565, 'duration': 4.502}, {'end': 184.908, 'text': "And other than that, you see there's just kind of regular file names.", 'start': 181.087, 'duration': 3.821}], 'summary': 'Demonstrating usage of command line to list files in directory.', 'duration': 39.971, 'max_score': 144.937, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM144937.jpg'}, {'end': 267.726, 'src': 'embed', 'start': 207.193, 'weight': 2, 'content': [{'end': 216.844, 'text': 'is that when you do a Lister to get file names out of a directory, just that file name on its own, just out in space, is not a valid path.', 'start': 207.193, 'duration': 9.651}, {'end': 222.106, 'text': 'It needs to be connected to the directory it came from to make a valid path.', 'start': 218.002, 'duration': 4.104}, {'end': 227.192, 'text': "So the way I could do that, so you always have, you're always, as soon as you call Lister, you're disconnecting the file name from path.", 'start': 222.507, 'duration': 4.685}, {'end': 228.753, 'text': "So you have to realize you've immediately made it.", 'start': 227.212, 'duration': 1.541}, {'end': 232.697, 'text': 'Now, with the current directory as dot or something, you might be able to kind of fudge through on some of these,', 'start': 229.094, 'duration': 3.603}, {'end': 235.019, 'text': "but then you'd have a bug if someone was running in a different directory.", 'start': 232.697, 'duration': 2.322}, {'end': 243.679, 'text': "So, in the OS package, there's a OS, there's a subpart called os.path.", 'start': 236.496, 'duration': 7.183}, {'end': 250.301, 'text': 'And inside of os.path, there are utilities for manipulating file paths, taking them apart, putting them together, that kind of stuff.', 'start': 244.339, 'duration': 5.962}, {'end': 252.682, 'text': 'And again, these are a little bit platform independent.', 'start': 250.321, 'duration': 2.361}, {'end': 255.663, 'text': "So, on Windows or whatever, like, there's some chance this might work.", 'start': 253.062, 'duration': 2.601}, {'end': 257.644, 'text': "I'm sorry, it would definitely work.", 'start': 256.403, 'duration': 1.241}, {'end': 267.726, 'text': 'So join takes a directory and a file name and puts them back together in a platform valid way.', 'start': 260, 'duration': 7.726}], 'summary': 'Lister requires connecting file name to directory for valid path; os.path has utilities for file path manipulation.', 'duration': 60.533, 'max_score': 207.193, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM207193.jpg'}, {'end': 333.273, 'src': 'heatmap', 'start': 280.375, 'weight': 0.807, 'content': [{'end': 281.355, 'text': "So I'll do that on the path.", 'start': 280.375, 'duration': 0.98}, {'end': 283.377, 'text': "And what that's going to do, it's kind of like a PWD.", 'start': 281.375, 'duration': 2.002}, {'end': 291.336, 'text': "It takes the path and it's going to just fill it out to be repeat.", 'start': 287.895, 'duration': 3.441}, {'end': 292.396, 'text': "So, let's try that.", 'start': 291.456, 'duration': 0.94}, {'end': 305.64, 'text': "So, if I run that on dot and there's a module, okay, what did I do wrong there? OS, oh, it's not apps bath.", 'start': 294.056, 'duration': 11.584}, {'end': 307.34, 'text': 'All right.', 'start': 307.04, 'duration': 0.3}, {'end': 312.042, 'text': 'Well, let it be said, my demos do not lack for realism.', 'start': 309.141, 'duration': 2.901}, {'end': 315.883, 'text': "All right, so here I'm running it on the directory dot.", 'start': 313.12, 'duration': 2.763}, {'end': 321.829, 'text': 'And so then here the first line is it just puts it back together with a slash.', 'start': 316.684, 'duration': 5.145}, {'end': 323.411, 'text': "I think let's just try it.", 'start': 322.55, 'duration': 0.861}, {'end': 326.374, 'text': 'If I said like dot slash.', 'start': 323.851, 'duration': 2.523}, {'end': 333.273, 'text': "Notice, it's smart about not doubling up the slash there, where if you just put it together with a plus, you would have done the wrong thing in there.", 'start': 328.109, 'duration': 5.164}], 'summary': 'Demonstrating path manipulation with pwd command and module on a directory dot.', 'duration': 52.898, 'max_score': 280.375, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM280375.jpg'}], 'start': 73.734, 'title': 'Python file operations', 'summary': "Delves into using python's os.lister function to retrieve file names, and demonstrates file path manipulation using os.path utilities such as join, abspath, exists, mkdir, and shutil.copy.", 'chapters': [{'end': 227.192, 'start': 73.734, 'title': "Working with python's os.lister", 'summary': "Discusses the usage of python's os.lister function, which takes a path and returns a list of file names in the directory, and demonstrates its application through modifying an example to list files.", 'duration': 153.458, 'highlights': ['The os.lister function takes a path and returns a list of file names in the directory, providing a practical way to access and manipulate file information.', "The demonstration involves modifying the 'hello.py' example to list files by using os.lister on a given directory, showcasing the practical application of the function.", 'Understanding the need to connect the retrieved file names to their directory to form valid paths is emphasized, adding a crucial insight into working with os.lister.']}, {'end': 488.362, 'start': 227.212, 'title': 'Manipulating file paths in python', 'summary': 'Explores the os package in python, demonstrating the manipulation of file paths and the use of utilities like os.path.join, os.path.abspath, os.path.exists, os.mkdir, and shutil.copy.', 'duration': 261.15, 'highlights': ['The chapter explores the OS package in Python, demonstrating the manipulation of file paths and the use of utilities like os.path.join, os.path.abspath, os.path.exists, os.mkdir, and shutil.copy.', 'The utility os.path.join takes a directory and a file name, putting them back together in a platform-valid way.', 'The os.path.abspath acts like a PWD, taking the path and filling it out to be repeat.', 'The os.path.exists utility checks if a specified path exists.', 'The shutil.copy utility in the shutil module performs file copying by taking a source path and a destination path.']}], 'duration': 414.628, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM73734.jpg', 'highlights': ["The demonstration involves modifying the 'hello.py' example to list files by using os.lister on a given directory, showcasing the practical application of the function.", 'The os.lister function takes a path and returns a list of file names in the directory, providing a practical way to access and manipulate file information.', 'The chapter explores the OS package in Python, demonstrating the manipulation of file paths and the use of utilities like os.path.join, os.path.abspath, os.path.exists, os.mkdir, and shutil.copy.', 'Understanding the need to connect the retrieved file names to their directory to form valid paths is emphasized, adding a crucial insight into working with os.lister.', 'The utility os.path.join takes a directory and a file name, putting them back together in a platform-valid way.']}, {'end': 704.211, 'segs': [{'end': 555.357, 'src': 'heatmap', 'start': 517.332, 'weight': 0, 'content': [{'end': 527.386, 'text': "There's a module called commands and inside of commands, There's a function called get status output.", 'start': 517.332, 'duration': 10.054}, {'end': 529.368, 'text': "I'll do help on it.", 'start': 528.668, 'duration': 0.7}, {'end': 531.611, 'text': 'Oh boy, the help is pretty short.', 'start': 529.388, 'duration': 2.223}, {'end': 535.315, 'text': 'What it does is it runs that command.', 'start': 532.852, 'duration': 2.463}, {'end': 537.597, 'text': "So it's going to shell out as an external process.", 'start': 535.335, 'duration': 2.262}, {'end': 540.22, 'text': "It's going to run that command and you're going to block.", 'start': 537.657, 'duration': 2.563}, {'end': 541.301, 'text': 'So it causes you to wait.', 'start': 540.24, 'duration': 1.061}, {'end': 545.605, 'text': "It's going to wait for that subprocess to exit.", 'start': 542.062, 'duration': 3.543}, {'end': 551.131, 'text': 'And the standard out and standard error of that subprocess are captured.', 'start': 546.585, 'duration': 4.546}, {'end': 554.075, 'text': "They're not just written onto your standard out and standard error.", 'start': 551.492, 'duration': 2.583}, {'end': 555.357, 'text': "So the thing is it's kind of sealed.", 'start': 554.115, 'duration': 1.242}], 'summary': 'The get status output function runs a command, capturing its output and causing a wait for the subprocess to exit.', 'duration': 45.907, 'max_score': 517.332, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM517332.jpg'}, {'end': 604.955, 'src': 'embed', 'start': 574.277, 'weight': 2, 'content': [{'end': 578.301, 'text': 'So just in a very typical Unix-y kind of way where, you know, you can recover the exit code out of there.', 'start': 574.277, 'duration': 4.024}, {'end': 583.086, 'text': 'And then the second is a big string which is all of the output of this thing.', 'start': 578.902, 'duration': 4.184}, {'end': 587.289, 'text': "And in this case, I think it's both the standard output and the standard error kind of counted onto each other.", 'start': 583.426, 'duration': 3.863}, {'end': 594.772, 'text': 'Now, there are a bunch of variants of this if you want to capture the standard error separately or all sorts of permutations are covered.', 'start': 588.73, 'duration': 6.042}, {'end': 595.992, 'text': "But this is the one we're going to use today.", 'start': 594.792, 'duration': 1.2}, {'end': 597.493, 'text': 'All right.', 'start': 596.012, 'duration': 1.481}, {'end': 598.213, 'text': "So, I'll get out of here.", 'start': 597.513, 'duration': 0.7}, {'end': 604.955, 'text': "And I think what I'm going to do is I'm going to modify my, well, here.", 'start': 598.233, 'duration': 6.722}], 'summary': 'The unix-y way allows capturing exit code and output, including standard error, with various options covered.', 'duration': 30.678, 'max_score': 574.277, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM574277.jpg'}, {'end': 713.212, 'src': 'embed', 'start': 681.202, 'weight': 4, 'content': [{'end': 682.823, 'text': 'It went through the commands module.', 'start': 681.202, 'duration': 1.621}, {'end': 683.523, 'text': 'It launched it.', 'start': 682.843, 'duration': 0.68}, {'end': 685.444, 'text': 'My Python program waits blocks.', 'start': 683.623, 'duration': 1.821}, {'end': 686.984, 'text': 'Eventually the thing ran.', 'start': 685.944, 'duration': 1.04}, {'end': 689.365, 'text': 'It produced your, you know, typical ls minus l sort of output.', 'start': 687.064, 'duration': 2.301}, {'end': 691.306, 'text': "And then I'm done.", 'start': 690.706, 'duration': 0.6}, {'end': 692.346, 'text': 'All right.', 'start': 691.346, 'duration': 1}, {'end': 694.907, 'text': "So now this is, I'm going to fix this up in a couple of ways.", 'start': 692.366, 'duration': 2.541}, {'end': 697.468, 'text': 'I regard this as like not quite right.', 'start': 695.227, 'duration': 2.241}, {'end': 704.211, 'text': 'So one thing I want to do is I want to notice if this thing failed.', 'start': 699.269, 'duration': 4.942}, {'end': 706.709, 'text': "And the way I'm going to do that?", 'start': 705.748, 'duration': 0.961}, {'end': 713.212, 'text': "the simplest way is, I'm just going to say if status, if the status is non-zero, then I want to notice that there was an error.", 'start': 706.709, 'duration': 6.503}], 'summary': 'Python program executed commands, detected errors, produced output.', 'duration': 32.01, 'max_score': 681.202, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM681202.jpg'}], 'start': 488.903, 'title': 'Launching external processes in python', 'summary': "Introduces launching external processes in python using the 'commands' module, focusing on the function 'get status output' and discussing capturing subprocess output, returning a tuple with the exit code and output, along with handling standard error separately.", 'chapters': [{'end': 535.315, 'start': 488.903, 'title': 'Launching external processes in python', 'summary': "Introduces launching external processes in python using the 'commands' module and focuses on the function 'get status output', highlighting its usefulness and simplicity in running commands.", 'duration': 46.412, 'highlights': ["The 'commands' module in Python provides a useful function called 'get status output', which is emphasized as the most useful one for launching external processes.", "The chapter emphasizes the simplicity and utility of the 'get status output' function for running commands in Python."]}, {'end': 704.211, 'start': 535.335, 'title': 'Python commands module: capturing subprocess output', 'summary': 'Discusses the commands module in python, which captures the output of a subprocess as an external process, returning a tuple with the exit code and the output, and provides various options for handling standard error separately.', 'duration': 168.876, 'highlights': ['The commands module in Python captures the output of a subprocess as an external process, returning a tuple with the exit code and the output.', 'The captured output includes both the standard output and the standard error of the subprocess.', 'The commands module provides various options for handling standard error separately.']}], 'duration': 215.308, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM488903.jpg', 'highlights': ["The 'commands' module in Python provides a useful function called 'get status output', emphasized as the most useful one for launching external processes.", 'The commands module in Python captures the output of a subprocess as an external process, returning a tuple with the exit code and the output.', 'The captured output includes both the standard output and the standard error of the subprocess.', "The chapter emphasizes the simplicity and utility of the 'get status output' function for running commands in Python.", 'The commands module provides various options for handling standard error separately.']}, {'end': 1004.475, 'segs': [{'end': 782.226, 'src': 'embed', 'start': 705.748, 'weight': 0, 'content': [{'end': 706.709, 'text': "And the way I'm going to do that?", 'start': 705.748, 'duration': 0.961}, {'end': 713.212, 'text': "the simplest way is, I'm just going to say if status, if the status is non-zero, then I want to notice that there was an error.", 'start': 706.709, 'duration': 6.503}, {'end': 719.356, 'text': "And so that because status is coming through as an int, if, you know, if it's zero, that's going to count as false, any other value counts as true.", 'start': 713.232, 'duration': 6.124}, {'end': 721.417, 'text': "So that's sort of the most primitive way of detecting an error here.", 'start': 719.376, 'duration': 2.041}, {'end': 731.563, 'text': "So then I'm going to say something like print, I think I could refer to this standard error, you know, whatever, there was an error.", 'start': 721.817, 'duration': 9.746}, {'end': 740.077, 'text': "Now I'm being a little picky here, because when you capture the standard error of subprocess if I were to sort of squelch it,", 'start': 732.95, 'duration': 7.127}, {'end': 744.742, 'text': 'if I was to just kind of eat it and hide it it makes this system undebugable.', 'start': 740.077, 'duration': 4.665}, {'end': 748.805, 'text': "I mean, if you think about software systems, where it's some big thing with a lot of parts,", 'start': 744.762, 'duration': 4.043}, {'end': 754.39, 'text': "It's the key piece of information when it's used incorrectly, which of course it is, is that,", 'start': 749.446, 'duration': 4.944}, {'end': 757.373, 'text': 'whatever the lowest level was that ran into the error reports it.', 'start': 754.39, 'duration': 2.983}, {'end': 759.895, 'text': "It raises some kind of message like, hey, this didn't work.", 'start': 757.393, 'duration': 2.502}, {'end': 764.039, 'text': 'And you are really dependent on that low level letting you know.', 'start': 760.335, 'duration': 3.704}, {'end': 768.763, 'text': "Or put the other way, if the low level fails and remains silent, it's very, very difficult to debug.", 'start': 764.059, 'duration': 4.704}, {'end': 773.247, 'text': "And I'm pointing this out because this is the rare case where we are capturing the standard error of that thing.", 'start': 769.183, 'duration': 4.064}, {'end': 776.83, 'text': 'And so we are kind of responsible for making sure that it gets reported.', 'start': 773.487, 'duration': 3.343}, {'end': 779.884, 'text': "So, and I'll just say something like that.", 'start': 778.383, 'duration': 1.501}, {'end': 782.226, 'text': "And then I'm going to say sys.exit1.", 'start': 780.285, 'duration': 1.941}], 'summary': 'Using if status non-zero to detect errors and reporting to standard error, emphasizing importance of low-level error reporting.', 'duration': 76.478, 'max_score': 705.748, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM705748.jpg'}, {'end': 891.787, 'src': 'embed', 'start': 865.455, 'weight': 6, 'content': [{'end': 869.338, 'text': "And then, I'll just like return, whatever, just don't get to the stuff below.", 'start': 865.455, 'duration': 3.883}, {'end': 875.303, 'text': 'Because you can sort of debug your program, all this other reading directories or whatever kind of stuff, and you can still have it print.', 'start': 869.358, 'duration': 5.945}, {'end': 876.463, 'text': "here's the command it's going to do.", 'start': 875.303, 'duration': 1.16}, {'end': 879.986, 'text': "And so it's more pleasing, I think, to debug it that way.", 'start': 877.404, 'duration': 2.582}, {'end': 880.767, 'text': "So let's just try this.", 'start': 880.146, 'duration': 0.621}, {'end': 882.128, 'text': "So I'm going to save it.", 'start': 880.787, 'duration': 1.341}, {'end': 885.791, 'text': 'And that definitely returns, right? Okay.', 'start': 883.609, 'duration': 2.182}, {'end': 890.046, 'text': 'Hey, you know, the snapshot directory would totally bail me out here.', 'start': 888.224, 'duration': 1.822}, {'end': 891.006, 'text': "It's unscrupable.", 'start': 890.246, 'duration': 0.76}, {'end': 891.787, 'text': 'All right.', 'start': 891.026, 'duration': 0.761}], 'summary': 'Debug program with print command, save return, snapshot directory bails out.', 'duration': 26.332, 'max_score': 865.455, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM865455.jpg'}, {'end': 994.472, 'src': 'embed', 'start': 964.948, 'weight': 7, 'content': [{'end': 965.508, 'text': "So let's see.", 'start': 964.948, 'duration': 0.56}, {'end': 968.57, 'text': "Now it's doing ls minus l, right? All right.", 'start': 967.109, 'duration': 1.461}, {'end': 971.593, 'text': "Anyway, so that's the, that is the better syntax for that.", 'start': 969.191, 'duration': 2.402}, {'end': 973.275, 'text': 'All righty.', 'start': 972.914, 'duration': 0.361}, {'end': 974.415, 'text': 'So let me show you.', 'start': 973.515, 'duration': 0.9}, {'end': 978.759, 'text': 'So those are the two module things I want you to work on for this next bit.', 'start': 974.435, 'duration': 4.324}, {'end': 981.701, 'text': 'So let me show you our next exercise.', 'start': 979.8, 'duration': 1.901}, {'end': 984.543, 'text': 'All right.', 'start': 984.263, 'duration': 0.28}, {'end': 986.124, 'text': "So I'm going to go into day two here.", 'start': 984.563, 'duration': 1.561}, {'end': 989.287, 'text': 'And the next one I want to work on is copy special.', 'start': 987.165, 'duration': 2.122}, {'end': 994.472, 'text': "So as before, there's a printed form of the description of this.", 'start': 990.851, 'duration': 3.621}], 'summary': "The transcript covers commands and tasks for two modules and a next exercise on 'copy special'.", 'duration': 29.524, 'max_score': 964.948, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM964948.jpg'}], 'start': 705.748, 'title': 'Error detection and reporting and importance of attention in coding', 'summary': 'Discusses error detection methods and the significance of capturing and reporting low-level errors for effective debugging. it also emphasizes the importance of attention to coding details, highlights potential bug consequences, and suggests debugging strategies, with a focus on a specific exercise for the next module.', 'chapters': [{'end': 782.226, 'start': 705.748, 'title': 'Error detection and reporting', 'summary': 'Discusses the primitive method of error detection in a software system, emphasizing the significance of capturing and reporting low-level errors to ensure effective debugging.', 'duration': 76.478, 'highlights': ['The significance of capturing and reporting low-level errors to ensure effective debugging.', 'The primitive method of error detection in a software system by checking the status as non-zero to indicate an error.', 'The importance of not squelching or hiding the standard error of subprocess as it makes the system undebuggable.', 'Emphasizing the difficulty of debugging when the low level fails and remains silent.']}, {'end': 1004.475, 'start': 782.286, 'title': 'Importance of attention in coding', 'summary': 'Emphasizes the importance of paying attention to coding details, highlighting the potential consequences of bugs in different scenarios, and suggests strategies for debugging, with a focus on a specific exercise for the next module.', 'duration': 222.189, 'highlights': ['The potential consequences of bugs in coding are emphasized, illustrating the contrast between minor errors in data processing and critical errors in string manipulation for shell commands.', 'The speaker recommends a strategy for debugging by printing the command before execution to ensure accuracy and mitigate potential errors.', "The importance of attention to coding details is exemplified through the speaker's focus on debugging and syntax correctness, emphasizing the significance of precision in programming.", "The chapter introduces the upcoming exercise 'copy special' and emphasizes the need for attention to detail for successfully completing the module."]}], 'duration': 298.727, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM705748.jpg', 'highlights': ['The significance of capturing and reporting low-level errors to ensure effective debugging.', 'The importance of attention to coding details and syntax correctness for effective debugging.', 'The potential consequences of bugs in coding, illustrating the contrast between minor and critical errors.', 'The primitive method of error detection in a software system by checking the status as non-zero to indicate an error.', 'The importance of not squelching or hiding the standard error of subprocess as it makes the system undebuggable.', 'The difficulty of debugging when the low level fails and remains silent.', 'The speaker recommends a strategy for debugging by printing the command before execution to ensure accuracy and mitigate potential errors.', "The chapter introduces the upcoming exercise 'copy special' and emphasizes the need for attention to detail for successfully completing the module."]}, {'end': 1209.386, 'segs': [{'end': 1044.575, 'src': 'embed', 'start': 1021.124, 'weight': 0, 'content': [{'end': 1034.17, 'text': "And in particular I'm going to say that a file name is special if it has the pattern that somewhere in the file name there are two underbars and then one or more word characters followed by two underbars.", 'start': 1021.124, 'duration': 13.046}, {'end': 1040.373, 'text': 'And then, so for example, in this directory, there are two special files.', 'start': 1036.491, 'duration': 3.882}, {'end': 1041.613, 'text': "There's the hello and the something.", 'start': 1040.413, 'duration': 1.2}, {'end': 1044.575, 'text': "And then the solution directory and copy special, those aren't special.", 'start': 1041.993, 'duration': 2.582}], 'summary': 'Identifying special files with specific file name pattern, resulting in two special files in the directory.', 'duration': 23.451, 'max_score': 1021.124, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM1021124.jpg'}, {'end': 1093.56, 'src': 'embed', 'start': 1064.348, 'weight': 2, 'content': [{'end': 1066.789, 'text': "So here, I'm going to run it on dot, just the current directory.", 'start': 1064.348, 'duration': 2.441}, {'end': 1072.891, 'text': 'So if I run it on dot, what I want you to do, so it takes a directory as an argument.', 'start': 1068.469, 'duration': 4.422}, {'end': 1077.173, 'text': 'What I want you to do is I want you to find all the special files and just list them.', 'start': 1073.131, 'duration': 4.042}, {'end': 1080.974, 'text': 'And in particular, list them by their absolute paths.', 'start': 1078.793, 'duration': 2.181}, {'end': 1085.616, 'text': 'The absolute path is something if you were writing a path to a file or whatever.', 'start': 1082.314, 'duration': 3.302}, {'end': 1088.677, 'text': "the absolute path is nice because it's independent of the process that produced it.", 'start': 1085.616, 'duration': 3.061}, {'end': 1090.218, 'text': "It doesn't depend on a notional current directory.", 'start': 1088.717, 'duration': 1.501}, {'end': 1093.56, 'text': "It's like, this really is where that file is.", 'start': 1090.238, 'duration': 3.322}], 'summary': 'Find all special files in the current directory and list their absolute paths.', 'duration': 29.212, 'max_score': 1064.348, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM1064348.jpg'}, {'end': 1202.022, 'src': 'embed', 'start': 1178.014, 'weight': 4, 'content': [{'end': 1184.555, 'text': 'So it turns out the command you want is zip-j and then the name of the zip file and then you just have all the paths.', 'start': 1178.014, 'duration': 6.541}, {'end': 1188.634, 'text': 'Now, in this case, I used absolute paths.', 'start': 1186.893, 'duration': 1.741}, {'end': 1193.237, 'text': 'Really, the zip is going to have the same current directory as me, so you can do the shorter name or,', 'start': 1189.755, 'duration': 3.482}, {'end': 1195.278, 'text': "depending on your tolerance for that kind of fragility, it's fine.", 'start': 1193.237, 'duration': 2.041}, {'end': 1197.279, 'text': "So, that'll zip it up.", 'start': 1195.378, 'duration': 1.901}, {'end': 1199.48, 'text': "Okay So, that is, that's the next exercise.", 'start': 1197.659, 'duration': 1.821}, {'end': 1202.022, 'text': "So, I'd like you to go ahead and get started on that.", 'start': 1200.101, 'duration': 1.921}], 'summary': 'Using zip-j command with absolute paths to zip files in the same directory.', 'duration': 24.008, 'max_score': 1178.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM1178014.jpg'}], 'start': 1005.075, 'title': 'File system and google admin tools', 'summary': 'Discusses identifying special file names in the file system using a specific pattern and covers using a google admin tool to find, move, and zip special files. it also includes instructions for listing, moving, and zipping files, along with a brief challenge to the audience.', 'chapters': [{'end': 1044.575, 'start': 1005.075, 'title': 'File system assignment: identifying special file names', 'summary': 'Introduces the concept of special file names in the file system, with the pattern of two underbars, one or more word characters, and two underbars. it highlights the identification of two special files in the given directory.', 'duration': 39.5, 'highlights': ['Introduction of special file names pattern', 'Identification of two special files in the directory']}, {'end': 1209.386, 'start': 1045.598, 'title': 'Google admin file management', 'summary': "Covers the usage of a google admin tool to find, move, and zip special files, with instructions for listing special files, moving them to a specific directory, and zipping them into a file, followed by a mention of the zip utility's command and a brief challenge to the audience.", 'duration': 163.788, 'highlights': ['The command takes a directory as an argument and is used to find and list all the special files by their absolute paths, emphasizing the independence of the absolute path from the current directory.', "The next task involves using the command with two directory arguments to create a new directory, if it doesn't exist, and copy all the special files into it.", "Another task is similar to the previous one, but it involves zipping all the special files into a zip file, utilizing the zip utility with the 'zip -j' command to achieve the task efficiently."]}], 'duration': 204.311, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/uKZ8GBKmeDM/pics/uKZ8GBKmeDM1005075.jpg', 'highlights': ['Introduction of special file names pattern', 'Identification of two special files in the directory', 'Using a command to find and list all special files by their absolute paths', 'Copying all special files into a new directory using a specific command', "Zipping all special files into a zip file using the 'zip -j' command"]}], 'highlights': ["The chapter emphasizes the idea of using modules of existing code in Python to solve common problems, highlighting the file system interface and calling external processes. It showcases Python's ability to function as a better alternative to bash for gluing utilities together (3x).", 'The chapter introduces the OS module in Python, showcasing its functions for file system interface and calling external processes, emphasizing its usefulness as a better alternative to bash and its platform independence (3x).', 'The OS module in Python contains various functions for operating system-oriented utilities, with a Unixy feeling, and aims to be platform independent (3x).', "The demonstration involves modifying the 'hello.py' example to list files by using os.lister on a given directory, showcasing the practical application of the function.", 'The os.lister function takes a path and returns a list of file names in the directory, providing a practical way to access and manipulate file information.', "The 'commands' module in Python provides a useful function called 'get status output', emphasized as the most useful one for launching external processes.", 'The significance of capturing and reporting low-level errors to ensure effective debugging.', 'The importance of attention to coding details and syntax correctness for effective debugging.', 'Introduction of special file names pattern', 'Identification of two special files in the directory']}