Updated the data code.

* Included dependency list file for the Python script.
* Handled the main errors I encountered during execution.
* Wrote the file at the end of the process instead of throughout.
* Wrote bytes to the file (the default type in Python 3 when writing to a file) instead of a list as before.