• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(2541)  |  Call(2493)  |  Derive(0)  |  Import(48)
Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default.

        def getenv(key, default=None):
    """Get an environment variable, return None if it doesn't exist.
    The optional second argument can specify an alternate default."""
    return environ.get(key, default)
        


src/p/y/python-cookbook-HEAD/cb2_examples/cb2_10_6_sol_1.py   python-cookbook(Download)
def what_editor():
    editor = os.getenv('VISUAL') or os.getenv('EDITOR')
    if not editor:
        if sys.platform == 'windows':
            editor = 'Notepad.Exe'
        else:
            editor = 'vi'

src/p/y/PyMT-0.5.1/examples/apps/mtwitter/twitter.py   PyMT(Download)
  def _GetUsername(self):
    '''Attempt to find the username in a cross-platform fashion.'''
    return os.getenv('USER') or \
        os.getenv('LOGNAME') or \
        os.getenv('USERNAME') or \
        os.getlogin() or \
        'nobody'

src/p/y/pyfusion-HEAD/examples/test_savez.py   pyfusion(Download)
tim=discretise_array(noisytime,eps=eps,verbose=verbose)
 
pushd=os.getcwd()
os.chdir(os.getenv('PYFUSIONPATH'))
os.chdir('..')
os.chdir('local_data')
try:

src/p/e/pexpect-HEAD/pexpect/examples/bd_serv.py   pexpect(Download)
 
    hostname = "127.0.0.1"
    port = 1664
    username = os.getenv('USER')
    password = ""
    daemon_mode = False
    if '-d' in options:

src/g/r/grin-1.2/examples/grinpython.py   grin(Download)
def grinpython_main(argv=None):
    if argv is None:
        # Look at the GRIN_ARGS environment variable for more arguments.
        env_args = shlex.split(os.getenv('GRIN_ARGS', ''))
        argv = [sys.argv[0]] + env_args + sys.argv[1:]
    parser = get_grinpython_arg_parser()
    args = parser.parse_args(argv[1:])

src/g/r/grin-1.2/examples/grinimports.py   grin(Download)
def grinimports_main(argv=None):
    if argv is None:
        # Look at the GRIN_ARGS environment variable for more arguments.
        env_args = shlex.split(os.getenv('GRIN_ARGS', ''))
        argv = [sys.argv[0]] + env_args + sys.argv[1:]
    parser = get_grinimports_arg_parser()
    args = parser.parse_args(argv[1:])

src/p/y/pyfusion-HEAD/examples/always_validate_test_signals.py   pyfusion(Download)
# try the nicer putenv first - but probably only affects child processes
os.putenv("PYFUSION_DEVICE","TestDevice")
# check to see if it worked
if os.getenv("PYFUSION_DEVICE") != "TestDevice":
    print "***Warning - being heavy handed with os.environ to correct DEVICE"
    os.environ.__setitem__("PYFUSION_DEVICE","TestDevice")
    # The worry is that directly operating on os.environ can cause memory leaks
if os.getenv("PYFUSION_DEVICE") != "TestDevice":

src/p/e/pexpect-2.4/examples/bd_serv.py   pexpect(Download)
 
    hostname = "127.0.0.1"
    port = 1664
    username = os.getenv('USER')
    password = ""
    daemon_mode = False
    if '-d' in options:

src/c/u/CUV-HEAD/examples/rbm/caller.py   CUV(Download)
 
cfg = Config(options, usage = "usage: %prog [options]")
try:
    sys.path.insert(0,os.path.join(os.getenv('HOME'),'bin'))
    import optcomplete
    optcomplete.autocomplete(cfg._parser)
except ImportError: 
elif cfg.dataset==pyrbm.Dataset.mnist_test:
    dataset = MNISTTestData(cfg,"/home/local/datasets/MNIST")
elif cfg.dataset==pyrbm.Dataset.image_patches:
    dataset = ImagePatchesData(cfg,os.getenv("HOME"))
elif cfg.dataset==pyrbm.Dataset.caltech or cfg.dataset==pyrbm.Dataset.caltech_big:
    dataset = CaltechData(cfg,"/home/local/datasets/batches","gray",0)
elif cfg.dataset==pyrbm.Dataset.caltech_color:

src/c/a/caspin-HEAD/trunk/samples/native_classes/as3/build_myclasses.py   caspin(Download)
#!/usr/bin/env python
 
import os
 
# the CASPIN_HOME environment variable
caspin_home = os.getenv("CASPIN_HOME")
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next