Can I store a file (HDF5 file) in another file with serialization?
<p>I have a HDF5 file and a list of objects that I need to store for saving functionality. For simplicity I want to create only one save file. Can I store H5 file, in my save file that I create with serialization (pickle) without opening H5 file. </p>

<p>You can put several files in one by using <a href="https://docs.python.org/3/library/zipfile.html" rel="nofollow">zipfile</a> or <a href="https://docs.python.org/3/library/tarfile.html" rel="nofollow">tarfile</a></p>

<ul>
<li>for zipfile you would <code>write</code> the database files and <code>writestr</code> your <code>pickle.dumps</code>ed data.</li>
<li>for tarfile you would <code>add</code> the database file and <code>gettarinfo</code>, <code>addfile</code> your <code>pickle.dump</code>ed data from a file.</li>
</ul>

<p>I would suggest creating a zip if you do not need extended filesystem-attributes because it is a bit easier to use.</p>

python serialization pickle hdf5