Merge pull request #247 from homeworkprod/patch-1
Before adoption: this commit came in with the history the project adopted, so no landing records it.
A few documentation fixes.
authored by Armin Ronacher · committed by Armin Ronacher · parents 7c138a6, 3c2de84 · Browse files · 1 file·+9 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+9 added−9 removed
- other:+9 added−9 removed
Provenance
- Commit
e1cbc25- Tree
4793fca- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
7c138a6- Parent 2
3c2de84
1 file changed+9 added−9 removed
modified:docs/python3.rst+9 added-9 removed
16 unmodified lines17 --------------------18 19 At the moment, Click suffers from a few problems with Python 3:20 21-* The command line in Unix traditionally is in bytes, and not Unicode.22- While there are encoding hints for all of this, there are generally23- some situations where this can break. The most common one is SSH21+* The command line in Unix traditionally is in bytes, not Unicode. While22+ there are encoding hints for all of this, there are generally some23+ situations where this can break. The most common one is SSH24 connections to machines with different locales.25 26 Misconfigured environments can currently cause a wide range of Unicode27 problems in Python 3 due to the lack of support for roundtripping27 unmodified lines55 Python 2 and 3 Differences56 --------------------------57 58 Click attempts to minimize the differences between Python 2 and Python 359-by following the best practices for both languages.59+by following best practices for both languages.60 61 In Python 2, the following is true:62 63 * ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` are opened in binary16 unmodified lines80 this works.81 * ``sys.argv`` is always Unicode-based. This also means that the native82 type for input values to the types in Click is Unicode, and not bytes.83 84- This causes problems when the terminal is incorrectly set and Python84+ This causes problems if the terminal is incorrectly set and Python85 does not figure out the encoding. In that case, the Unicode string86 will contain error bytes encoded as surrogate escapes.87 * When dealing with files, Click will always use the Unicode file system88 API calls by using the operating system's reported or guessed10 unmodified lines99 and is subject to its behavior. In Python 2, Click does all the Unicode100 handling itself, which means there are differences in error behavior.101 102 The most glaring difference is that in Python 2, Unicode will "just work",103-while in Python 3, it requires extra care. The reason for this is that on104-Python 3, the encoding detection is done in the interpreter and on Linux105-and certain other operating systems its encoding handling is problematic.103+while in Python 3, it requires extra care. The reason for this is that in104+Python 3, the encoding detection is done in the interpreter, and on Linux105+and certain other operating systems, its encoding handling is problematic.106 107 The biggest source of frustration is that Click scripts invoked by108 init systems (sysvinit, upstart, systemd, etc.), deployment tools (salt,109 puppet), or cron jobs (cron) will refuse to work unless a Unicode locale is9 unmodified lines119 Traceback (most recent call last):120 ...121 RuntimeError: Click will abort further execution because Python 3 was122 configured to use ASCII as encoding for the environment. Either switch123- to Python 2 or consult for http://click.pocoo.org/python3/123+ to Python 2 or consult http://click.pocoo.org/python3/ for124 mitigation steps.125 126 You are dealing with an environment where Python 3 thinks you are127 restricted to ASCII data. The solution to these problems is different27 unmodified lines