VirtualBox

Ignore:
Timestamp:
Jan 12, 2018 6:25:48 PM (7 years ago)
Author:
vboxsync
Message:

testboxdriver,testboxscript: Python3 updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/common/utils.py

    r70518 r70566  
    104104            else:
    105105                try:
    106                     sArch = processOutputChecked(['/usr/bin/isainfo', '-n',]);
     106                    sArch = str(processOutputChecked(['/usr/bin/isainfo', '-n',]));
    107107                except:
    108108                    pass;
     
    586586    Wrapper around subprocess.check_output to deal with its absense in older
    587587    python versions.
    588     """
     588    Extra keyword: sEncoding='utf-8; for specifying now output is to be decoded.
     589    """
     590    sEncoding = dKeywordArgs.get('sEncoding');
     591    if sEncoding is not None:   del dKeywordArgs['sEncoding'];
     592    else:                       sEncoding = 'utf-8';
     593
    589594    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
    590595    oProcess = processPopenSafe(stdout=subprocess.PIPE, *aPositionalArgs, **dKeywordArgs);
     
    600605        raise subprocess.CalledProcessError(iExitCode, asArgs);
    601606
    602     return str(sOutput); # str() make pylint happy.
     607    return sOutput.decode(sEncoding);
    603608
    604609g_fOldSudo = None;
     
    625630        if g_fOldSudo is None:
    626631            try:
    627                 sVersion = processOutputChecked(['sudo', '-V']);
     632                sVersion = str(processOutputChecked(['sudo', '-V']));
    628633            except:
    629634                sVersion = '1.7.0';
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette