def init():
    global sht21, lock_file, lock_handle
    if lock_file:
        try:
            lock_handle = open(lock_file, 'w')
        except IOError as e:
            collectd.error(('sht21 plugin: Could not open lock file: %s' % e))
            collectd.error('Proceeding without locking')
    try:
        sht21 = SHT21(1)
        collectd.info('sht21 user-mode plugin initialized')
    except IOError as e:
        collectd.error(('sht21 plugin: Could not initialize: %s' % e))
        collectd.unregister_read(read)
def init():
    global sht21, lock_file, lock_handle
    if lock_file:
        try:
            lock_handle = open(lock_file, 'w')
        except IOError as e:
            collectd.error(('sht21 plugin: Could not open lock file: %s' % e))
            collectd.error('Proceeding without locking')
    try:
        sht21 = SHT21(1)
        collectd.info('sht21 user-mode plugin initialized')
    except IOError as e:
        collectd.error(('sht21 plugin: Could not initialize: %s' % e))
        collectd.unregister_read(read)