network.py creates output dir if needed
create cache dir if nonexistent
Merge pull request #19 from aebrahim/master

File writing fails when output directory is nonexistent