File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,12 @@ as it is possible to create custom errors.
127127In that case,
128128hopefully the custom error message is informative enough to help you figure out what went wrong.
129129
130+ > ## Better errors on newer Pythons
131+ >
132+ > Newer versions of Python have improved error printouts. If you are debugging errors, it is often
133+ > helpful to use the latest Python version, even if you support older versions of Python.
134+ {: .callout}
135+
130136## Syntax Errors
131137
132138When you forget a colon at the end of a line,
@@ -373,7 +379,9 @@ you will receive a `FileNotFoundError` telling you so.
373379If you attempt to write to a file that was opened read-only, Python 3
374380returns an `UnsupportedOperationError`.
375381More generally, problems with input and output manifest as
376- `IOError`s or `OSError`s, depending on the version of Python you use.
382+ `OSError`s, which may show up as a more specific subclass; you can see
383+ [the list in the Python docs](https://docs.python.org/3/library/exceptions.html#os-exceptions).
384+ They all have a unique UNIX `errno`, which is you can see in the error message.
377385
378386~~~
379387file_handle = open('myfile.txt', 'r')
Original file line number Diff line number Diff line change @@ -534,7 +534,7 @@ This violates another important rule of programming:
534534> > * The first assertion checks that the input sequence `values` is not empty.
535535> > An empty sequence such as `[]` will make it fail.
536536> > * The second assertion checks that each value in the list can be turned into an integer.
537- > > Input such as `[1, 2,'c', 3]` will make it fail.
537+ > > Input such as `[1, 2, 'c', 3]` will make it fail.
538538> > * The third assertion checks that the total of the list is greater than 0.
539539> > Input such as `[-10, 2, 3]` will make it fail.
540540> {: .solution}
You can’t perform that action at this time.
0 commit comments