Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)
This is the equivalent of my windows.WindowsErrorDecode but for 
non windows OS

        def ErrorDecode(exception, encoding='utf-8'):
    """This is the equivalent of my windows.WindowsErrorDecode but for 
    non windows OS"""
    st=str(exception)
    try:
        return st.decode(encoding)
    except UnicodeDecodeError:
        return st.decode('ascii', 'replace')
        


src/m/k/mksbackup-1.0.4/mksbackuplib/main.py   mksbackup(Download)
    from windows import WindowsErrorDecode as ErrorDecode
else:
    from archiver import ErrorDecode
 
from version import __version__
        config_file=open(cmd_options.config, 'r')
    except IOError, e:
        log.error('error reading configuration file "%s": %s', cmd_options.config, ErrorDecode(e, default_encoding))
        sys.exit(1)
 
            config_file=codecs.open(cmd_options.config, 'r', cmd_options.encoding)        
        except LookupError, e:
            log.error('error reading configuration file %s: %s', cmd_options.config, ErrorDecode(e, default_encoding))
            sys.exit(1)
 
    config=ConfigParser.RawConfigParser(config_default)
    try:
        config.readfp(config_file)
    except (IOError, UnicodeDecodeError), e:
        log.error('error reading configuration file %s: %s', cmd_options.config, ErrorDecode(e, default_encoding))
                log.exception('loading job %s by program %s', job_name, program)
            except UnicodeDecodeError:
                log.error('loading job %s by program %s: %s', job_name, program, ErrorDecode(e, default_encoding))
 
            status=gen_status(start, job, 'ERR', None)