From the course: Building Tools with Python
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Ensuring functionality - Python Tutorial
From the course: Building Tools with Python
Ensuring functionality
- [Instructor] When we build something that will run in an environment different than our own, it's important to do some checking to make sure things are as we expect them to be. Here in Python, we can do that with a series of if statements or try accept statements to test for the things we assume will be present on the target system. If our script relies on an outside binary, for example, we can check for it, and if it doesn't exist, we can let the user know specifically that fact or just that some required software isn't available and that they should contact whoever supports the software to fix it. We can also take this approach to make sure that files or folders we need to write information to are writeable or even the particular modules are available before we go to try and use them. In a Python app, you might consider importing modules in a try block if you're expecting the presence of modules that aren't part…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Exploring the sample tool3m 6s
-
(Locked)
Using shell commands from Python3m 43s
-
(Locked)
Challenge: Use shell commands in Python52s
-
(Locked)
Solution: Use shell commands in Python2m 4s
-
(Locked)
Accepting arguments6m 31s
-
(Locked)
Challenge: Practice with arguments55s
-
(Locked)
Solution: Practice with arguments1m 28s
-
(Locked)
Providing error messages and logging5m 29s
-
(Locked)
Ensuring functionality2m 53s
-
(Locked)
Challenge: Check for necessary conditions51s
-
(Locked)
Solution: Check for necessary conditions1m 33s
-
(Locked)
Adding a user interface4m 28s
-
(Locked)
Packaging and distributing a tool4m 14s
-
(Locked)
Supporting the tool2m 2s
-
-