VirtualMailManager/cli/__init__.py
branchv0.7.x
changeset 654 f2463a64e1d7
parent 653 cf07e4468934
child 663 de435d1aa1c0
equal deleted inserted replaced
653:cf07e4468934 654:f2463a64e1d7
    29 
    29 
    30 def w_std(*args):
    30 def w_std(*args):
    31     """Writes a line for each arg of *args*, encoded in the current
    31     """Writes a line for each arg of *args*, encoded in the current
    32     ENCODING, to stdout.
    32     ENCODING, to stdout.
    33     """
    33     """
    34     _std_write('\n'.join(arg.encode(ENCODING, 'replace').decode()
    34     _std_write('\n'.join(arg.encode(ENCODING, 'replace').decode(ENCODING,
       
    35                                                                 'replace')
    35                for arg in args) + '\n')
    36                for arg in args) + '\n')
    36 
    37 
    37 
    38 
    38 def w_err(code, *args):
    39 def w_err(code, *args):
    39     """Writes a line for each arg of *args*, encoded in the current
    40     """Writes a line for each arg of *args*, encoded in the current
    40     ENCODING, to stderr.
    41     ENCODING, to stderr.
    41     This function optionally interrupts the program execution if *code*
    42     This function optionally interrupts the program execution if *code*
    42     does not equal to 0. *code* will be used as the system exit status.
    43     does not equal to 0. *code* will be used as the system exit status.
    43     """
    44     """
    44     _err_write('\n'.join(arg.encode(ENCODING, 'replace').decode()
    45     _err_write('\n'.join(arg.encode(ENCODING, 'replace').decode(ENCODING,
       
    46                                                                 'replace')
    45                for arg in args) + '\n')
    47                for arg in args) + '\n')
    46     if code:
    48     if code:
    47         os.sys.exit(code)
    49         os.sys.exit(code)
    48 
    50 
    49 
    51