(job, fn)
return os.path.join(job['cwd'], fn)
Like os.path.expanduser() but works for other users.
Like os.path.expanduser() but works for other users.
Like os . path . expanduser () but works for other users .
def full_path(job, fn):
    """Like os.path.expanduser() but works for other users.
    """
    if not fn:
        return fn
    if fn[0] == '~':
        if fn.find('/') > 0:
            user, rest = fn.split('/',1)
        else:
            user = fn
            rest = ''

        user = user[1:]
        if not user:
            user = job['user']

        # find home
        if user:
            home = pwd.getpwnam(user).pw_dir
        elif 'HOME' in os.environ:
            home = os.environ['HOME']
        else:
            home = os.pwd.getpwuid(os.getuid()).pw_dir

        if rest:
            return os.path.join(home, rest)
        else:
            return home
    # always return full path
    return os.path.join(job['cwd'], fn)
def full_path ( job , fn ) : if not fn : return fn if fn [ 0 ] == '~' : if fn . find ( '/' ) > 0 : user , rest = fn . split ( '/' , 1 ) else : user = fn rest = '' user = user [ 1 : ] if not user : user = job [ 'user' ] # find home if user : home = pwd . getpwnam ( user ) . pw_dir elif 'HOME' in os . environ : home = os . environ [ 'HOME' ] else : home = os . pwd . getpwuid ( os . getuid ( ) ) . pw_dir if rest : return os . path . join ( home , rest ) else : return home # always return full path return os . path . join ( job [ 'cwd' ] , fn )