Style: This might be cleaner as:

    if not os.path.exists(gdir):
        return [gdir, '', '']
    
    cmd = ...
    ...
    return info