File indexing completed on 2023-10-25 09:47:49
0001
0002 from __future__ import print_function
0003 import sys
0004 import os
0005 import readline
0006 import atexit
0007
0008 import ctypes
0009
0010 def interactive_inspect_mode():
0011
0012 flagPtr = ctypes.cast(ctypes.pythonapi.Py_InteractiveFlag,
0013 ctypes.POINTER(ctypes.c_int))
0014 return flagPtr.contents.value > 0 or bool(os.environ.get("PYTHONINSPECT",False))
0015
0016
0017 if __name__ == '__main__':
0018
0019
0020
0021
0022
0023 historyPath = os.path.expanduser("~/.pyhistory")
0024
0025
0026 def save_history(historyPath=historyPath):
0027 import readline
0028 readline.write_history_file(historyPath)
0029 if os.path.exists(historyPath):
0030 readline.read_history_file(historyPath)
0031
0032
0033 atexit.register(save_history)
0034 readline.parse_and_bind("set show-all-if-ambiguous on")
0035 readline.parse_and_bind("tab: complete")
0036 if os.path.exists (historyPath) :
0037 readline.read_history_file(historyPath)
0038 readline.set_history_length(-1)
0039
0040 if not interactive_inspect_mode():
0041 print("python -i `which interactivePythonTest.py` ")
0042
0043