Skip to main content

python-editor is a library that provides the editor module for programmatically interfacing with your system’s $EDITOR.

Examples

`python import editor commit_msg = editor.edit(contents=b"# Enter commit message here") `

Opens an editor, prefilled with the contents, # Enter commit message here. When the editor is closed, returns the contents (bytes) in variable commit_msg. Note that the argument to contents needs to be a bytes object on Python 3.

`python editor.edit(file="README.txt") `

Opens README.txt in an editor. Changes are saved in place. If there is a contents argument then the file contents will be overwritten.

`python editor.edit(..., use_tty=True) `

Opens the editor in a TTY. This is usually done in programs which output is piped to other programs. In this case the TTY is used as the editor’s stdout, allowing interactive usage.

How it Works

editor first looks for the ${EDITOR} environment variable. If set, it uses the value as-is, without fallbacks.

If no $EDITOR is set, editor will search through a list of known editors, and use the first one that exists on the system.

For example, on Linux, editor will look for the following editors in order:

  • vim

  • emacs

  • nano

When calling editor.edit, an editor will be opened in a subprocess, inheriting the parent process’s stdin, stdout.

Release files for python-editor 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-editor 1.0.4
File Size Uploaded
python-editor-1.0.4.tar.gz 7.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-editor 1.0.4
File
python_editor-1.0.4-py3.5.egg Legacy Egg format - - Details
python_editor-1.0.4-py3-none-any.whl Python 3 none any Details
python_editor-1.0.4-py2.7.egg Legacy Egg format - - Details
python_editor-1.0.4-py2-none-any.whl Python 2 none any Details

Total release size: 25.0 kB

Release files / python-editor-1.0.4.tar.gz

Download URL python-editor-1.0.4.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
51fda6bcc5ddbbb7063b2af7509e43bd84bfc32a4ff71349ec7847713882327b
BLAKE2b-256 checksum
How to use checksums
0a8578f4a216d28343a67b7397c99825cff336330893f00601443f7c7b2f2234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.12

Release files / python_editor-1.0.4-py3.5.egg

Download URL python_editor-1.0.4-py3.5.egg
Size 3.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
c3da2053dbab6b29c94e43c486ff67206eafbe7eb52dbec7390b5e2fb05aac77
BLAKE2b-256 checksum
How to use checksums
5234477695c3a37d921dba1bd0856c756525276bd42adc7ccfc6bf82f3778a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.12

Release files / python_editor-1.0.4-py3-none-any.whl

Download URL python_editor-1.0.4-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bf6e860a8ad52a14c3ee1252d5dc25b2030618ed80c022598f00176adc8367d
BLAKE2b-256 checksum
How to use checksums
c6d3201fc3abe391bbae6606e6f1d598c15d367033332bd54352b12f35513717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.12

Release files / python_editor-1.0.4-py2.7.egg

Download URL python_editor-1.0.4-py2.7.egg
Size 5.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
ea87e17f6ec459e780e4221f295411462e0d0810858e055fc514684350a2f522
BLAKE2b-256 checksum
How to use checksums
bce3019ed6d1a5a5e837739de55cda27b2f03045c9f9d84054b97e79a86fe2fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.12

Release files / python_editor-1.0.4-py2-none-any.whl

Download URL python_editor-1.0.4-py2-none-any.whl
Size 4.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
5f98b069316ea1c2ed3f67e7f5df6c0d8f10b689964a4a811ff64f0106819ec8
BLAKE2b-256 checksum
How to use checksums
55a03c0ba1c10f2ca381645dd46cb7afbb73fddc8de9f957e1f9e726a846eabc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.12

Release history Release notifications | RSS feed

This release

1.0.4 This release

5 release files

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0

1 release file

0.5

2 release files

0.4

1 release file

0.3

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page