Python - Startup script for the console ($PYTHONSTARTUP)

Card Puncher Data Processing


The environment variable named PYTHONSTARTUP points the name of a file containing your start-up commands.

This file is only read in interactive sessions, not from a script.

If you want to read an additional start-up file from the current directory, you can program this in the global start-up file, e.g. “execfile('.pythonrc')”.

If you want to use the startup file in a script, you must do this explicitly in the script:

import os
if os.path.isfile(os.environ['PYTHONSTARTUP']):
    # python 2
    # python 3

Documentation / Reference

For more information about PYTHONSTARTUP variable, read the python man page:

$ man python

Discover More
Card Puncher Data Processing
Python - Engine

How Python works. Mode: or interactive via the console.
Card Puncher Data Processing
Python - Installation and configuration

Installation and configuration of a python environment. Download it and install it Example: Linux: Configuration: Path Third library installation: You can also install...
Card Puncher Data Processing
Python - Script

in Python are source file that can be run. On Linux, begin your scripts with your interpreter. See or You can find them by executing the whereis commando: sys.argv[0] is the script name...

Share this page:
Follow us:
Task Runner