def _set_dest_value(self, dest, value, old_cwd = None):
        if value is None:
            return
        option = ([option for option in self._get_all_options () if option.dest == dest] + [None])[0]
        if option is None:
            print 'Could not find option with dest=%r for setting %r (dest not specified for option).' % (dest, value)
        else:
            if option.type in ['file', 'directory']:
                if old_cwd is not None:
                    value = os.path.join(old_cwd, value)
                else:
                    value = os.path.abspath(value)
                cwd = os.getcwd()
                if value.startswith(cwd):
                    value = value[len(cwd)+1:]
            if value == 'none':
                value = None
            else:
                try:
                    option.check_value(option.dest, str(value))
                except optparse.OptionValueError, msg:
                    print '_set_dest_value: ignoring %s' % msg
                    return
                option.default = value
        if value is None:
            try:
                del self.defaults[dest]
            except __HOLE__:
                pass
        else:
            self.defaults[dest] = value
dataset/ETHPy150Open pearu/pylibtiff/libtiff/optparse_gui.py/OptionParser._set_dest_value