title: Dealing with occational i2c write errors, Python + RaspberryPi
body: <p>I have a RaspberryPi connected to a temperature/humidity sensor via its i2c bus.  Normally everything works great, I send write commands and listen for the response.  However every now and then the script crashes to a halt with the same error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "humidify.py", line 20, in &lt;module&gt;
      humidity = HTU21DF.read_humidity()
    File "/home/pi/Desktop/Projects/HTU21DF.py", line 51, in read_humidity
      pi.i2c_write_byte(handle, rdhumi) # send read humi command
    File "/usr/local/lib/python2.7/dist-packages/pigpio.py", line 1861, in i2c_write_byte
      _pigpio_command(self.sl, _PI_CMD_I2CWS, handle, byte_val))
    File "/usr/local/lib/python2.7/dist-packages/pigpio.py", line 683, in _u2i
      raise error(error_text(v))
  pigpio.error: 'I2C write failed'
  </code></pre>
  
  <p>I'm not looking to weed out what causes that occasional error, I want my script to wait a second and try the i2c write command again.  If I can make that work then I'll really be able to automate my system instead of having to check it constantly for crashes.</p>
  
  <p>I'm a programming novice, so this is probably something basic.</p>