-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonstartup.py
More file actions
34 lines (32 loc) · 1.26 KB
/
pythonstartup.py
File metadata and controls
34 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Example snippet to use in a PYTHONSTARTUP file
from __future__ import print_function, unicode_literals, absolute_import
import ipdb # isn't loaded automatically when debugging with ipdb3.exe
print("hi freeo")
try:
import pyreadline.rlmain
# pyreadline.rlmain.config_path=r"C:\Users\arthur.jaron\dotfiles\pyreadlineconfig.ini"
import readline, atexit
import pyreadline.unicode_helper
# print("PyreadlineConfig loaded successfully")
#
#
#Normally the codepage for pyreadline is set to be sys.stdout.encoding
#if you need to change this uncomment the following line
#pyreadline.unicode_helper.pyreadline_codepage="utf8"
except ImportError as e:
print("{0}: Module readline not available.".format(e))
else:
#import tab completion functionality
import rlcompleter
#Override completer from rlcompleter to disable automatic ( on callable
completer_obj = rlcompleter.Completer()
def nop(val, word):
return word
completer_obj._callable_postfix = nop
readline.set_completer(completer_obj.complete)
#activate tab completion
readline.parse_and_bind("tab: complete")
readline.read_history_file()
atexit.register(readline.write_history_file)
del readline, rlcompleter, atexit
print("[OK] pyreadline")