title: Best practice for raising IOError exception in Python
body: <p>I am writing a small Python interface for reading temperatures from a DS18B20 Sensor via sysfs. Besides the temperature also a status of a CRC sum can be read. To trigger a CRC error, I decided to utilize <code>IOError</code>:</p>
  
  <pre><code>sn = "28-000005589697"  # sensor serial number
  # file containing information of temperature and if CRC is valid: 
  fname = "sys/bus/w1/devices/" + sn + "/w1_slave"
  with open(fname, 'f') as f: 
  ...
  raise IOError("Invalid CRC in {}!".format(sn))
  </code></pre>
  
  <p>As a far I understand <code>IOError</code>, it has the members <code>message</code>, <code>filename</code>, <code>errno</code> and <code>strerror</code>. By my approach only <code>message</code> is used. It seems like I am missing something here.</p>
  
  <p>What is the best practice to raise an <code>IOError</code> exception, so it blends in well with other errors such as <em>disk full</em> or <em>file not found</em>, etc.?</p>