title: How to open a bin file in Python using QDataStream
body: <p>I've got a bin file that was encoded in an application that I need to get access to and convert to a csv file. I've been given the documentation, but am not sure how to access the contents of this file in Python. </p>
  
  <p>Here are some of the details about how the dataset was serialized</p>
  
  <blockquote>
    <p>Datasets.bin is a list of DataSet classes serialized using Qt's QDataStream serialization using version QDataStream::Qt_4_7.</p>
  </blockquote>
  
  <pre><code>The format of the datasets.bin file is:
  
  quint32 Magic Number    0x46474247
  quint32 Version     1
  quint32 DataSet Marker  0x44415441
  qint32      # of DataSets       n
  DataSet DataSet 1
  DataSet DataSet 2
       .
       .
       .
       .
  DataSet DataSet n
  
  
  The format of each DataSet is:
  
  quint32     Magic Number    0x53455455  
  QString     Name
  quint32     Flags           Bit field (Set Table)
  QString     Id          [Optional]  
  QColor      Color           [Optional]
  qint32          Units           [Optional]
  QStringList         Creator Ids     [Optional]
  bool            Hidden          [Optional]
  QList&lt;double&gt;   Thresholds      [Optional]
  QString         Source          [Optional]
  qint32          Role            [Optional]
  QVector&lt;QPointF&gt;    data points
  </code></pre>
  
  <p>I've been looking in to the PyQt4 datastream documentation, but I can't seem to find any specific examples. Any help pointing me in the right direction would be great</p>