network.py creates output dir if needed
create cache dir if nonexistent