Last updated:
0 purchases
pyCmdlineHistory 1.1.6
Shield:
This work is licensed under a Creative Commons Attribution-ShareAlike
4.0 International
License.
Save command line history and provide a command line completer for
python.
Original code is from ActiveState Code »
Recipes
2006.06.29 by Sunjoong LEE. ActiveState content
is published under CC BY-SA
3.0.
Usage
Insert the lines
import sys
import subprocess
try:
import berhoel.cmd_line_history
except ImportError:
# checking if python is running under virtualenv of venv
is_venv = (
# This handles PEP 405 compliant virtual environments.
(sys.prefix != getattr(sys, "base_prefix", sys.prefix))
or
# This handles virtual environments created with pypa's virtualenv.
hasattr(sys, "real_prefix")
)
subprocess.check_call(
[sys.executable, "-m", "pip", "install"]
+ ([] if is_venv else ["--user"])
+ ["pyCmdlineHistory",]
)
to “~/.pystartup” file, and set an environment variable to point to it:
export PYTHONSTARTUP=${HOME}/.pystartup
in bash.
This will locally install the module for each python you are calling.
Documentation
Documentation can be found here
References
Guido van Rossum. Python Tutorial. Python Software Foundation, 2005.
86
Jian Ding Chen. Indentable rlcompleter. Python Cookbook Recipe 496812
Guido van Rossum. rlcompleter.py. Python Software Foundation, 2005
2006.06.29 Sunjoong LEE [email protected]
2020 - 2023 Berthold Höllmann [email protected]
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.