-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.pythonstartup
71 lines (58 loc) · 1.42 KB
/
.pythonstartup
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- encoding: utf-8 -*-
# Pythonスタートアップ
# ヒストリファイル名
HISTORY_FILE = ".pythonhistory"
# よく使うものをインストール
# from __future__ import print_function
import calendar
import cmath
import datetime
import time
import functools
import io
import itertools
import os
import re
import sys
try:
from see import see
except ImportError:
pass
# readlineの補完用
import rlcompleter
import readline
import atexit
try:
# ヒストリファイルのパスを取得
histfile = os.path.join(os.environ['HOME'], HISTORY_FILE)
# Tab補完を有効
readline.parse_and_bind("tab: complete")
# 日本語関係の設定
readline.parse_and_bind("set input-meta on")
readline.parse_and_bind("set convert-meta off")
readline.parse_and_bind("set output-meta on")
# ヒストリファイルのサイズ
readline.set_history_length(10000)
try:
f = open(histfile, "a")
f.close()
readline.read_history_file(histfile)
except IOError:
pass
try:
atexit.register(lambda: readline.write_history_file(histfile))
except:
pass
except:
pass
del f, HISTORY_FILE
# inspect
# http://d.hatena.ne.jp/maedana/20070919/1190206853
import inspect
igd = inspect.getdoc
igs = inspect.getsource
igf = inspect.getfile
igsl = inspect.getsourcelines
# Print python path
print(os.path.realpath(sys.executable))
# vim: ft=python