123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import os
- def __exithandler():
- try:
- readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
- except IOError:
- pass
- def __registerExitHandler():
- import atexit
- atexit.register( __exithandler )
- def __enableReadlineSupport():
- readline.set_history_length( 1000 )
- readline.parse_and_bind( "tab: complete" )
- try:
- readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
- except IOError:
- pass
- def __enableDefaultEncoding():
- import sys
- try:
- sys.setdefaultencoding( "utf8" )
- except LookupError:
- pass
- import sys
- try:
- import rlcompleter, readline
- except ImportError:
- pass
- else:
- __enableDefaultEncoding()
- __registerExitHandler()
- __enableReadlineSupport()
|