+++ /dev/null
-"""Hook to allow user-specified customization code to run.\r
-\r
-As a policy, Python doesn't run user-specified code on startup of\r
-Python programs (interactive sessions execute the script specified in\r
-the PYTHONSTARTUP environment variable if it exists).\r
-\r
-However, some programs or sites may find it convenient to allow users\r
-to have a standard customization file, which gets run when a program\r
-requests it. This module implements such a mechanism. A program\r
-that wishes to use the mechanism must execute the statement\r
-\r
- import user\r
-\r
-The user module looks for a file .pythonrc.py in the user's home\r
-directory and if it can be opened, execfile()s it in its own global\r
-namespace. Errors during this phase are not caught; that's up to the\r
-program that imports the user module, if it wishes.\r
-\r
-The user's .pythonrc.py could conceivably test for sys.version if it\r
-wishes to do different things depending on the Python version.\r
-\r
-"""\r
-from warnings import warnpy3k\r
-warnpy3k("the user module has been removed in Python 3.0", stacklevel=2)\r
-del warnpy3k\r
-\r
-import os\r
-\r
-home = os.curdir # Default\r
-if 'HOME' in os.environ:\r
- home = os.environ['HOME']\r
-elif os.name == 'posix':\r
- home = os.path.expanduser("~/")\r
-elif os.name == 'nt': # Contributed by Jeff Bauer\r
- if 'HOMEPATH' in os.environ:\r
- if 'HOMEDRIVE' in os.environ:\r
- home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']\r
- else:\r
- home = os.environ['HOMEPATH']\r
-\r
-pythonrc = os.path.join(home, ".pythonrc.py")\r
-try:\r
- f = open(pythonrc)\r
-except IOError:\r
- pass\r
-else:\r
- f.close()\r
- execfile(pythonrc)\r