https://github.com/chainer/chainer
Raw File
Tip revision: e611f65fa525126063594f959c432ad57c38ac8a authored by Seiya Tokui on 17 May 2016, 05:34:28 UTC
Merge pull request #1184 from pfnet/v1.8.2
Tip revision: e611f65
utils.py
import os


def print_warning(*lines):
    print('**************************************************')
    for line in lines:
        print('*** WARNING: %s' % line)
    print('**************************************************')


def get_path(key):
    return os.environ.get(key, '').split(os.pathsep)


def search_on_path(filenames):
    for p in get_path('PATH'):
        for filename in filenames:
            full = os.path.join(p, filename)
            if os.path.exists(full):
                return os.path.abspath(full)
    return None
back to top