VirtualBox

Ignore:
Timestamp:
Jan 12, 2018 8:19:37 PM (7 years ago)
Author:
vboxsync
Message:

utils.py: Python 3 fixes.

File:
1 edited

Legend:

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

    r70566 r70567  
    373373    return oFile;
    374374
    375 def noxcptReadLink(sPath, sXcptRet):
     375def noxcptReadLink(sPath, sXcptRet, sEncoding = 'utf-8'):
    376376    """
    377377    No exceptions os.readlink wrapper.
     
    380380        sRet = os.readlink(sPath); # pylint: disable=E1101
    381381    except:
    382         sRet = sXcptRet;
    383     return sRet;
     382        return sXcptRet;
     383    return sRet.decode(sEncoding, 'ignore');
    384384
    385385def readFile(sFile, sMode = 'rb'):
     
    392392    return sRet;
    393393
    394 def noxcptReadFile(sFile, sXcptRet, sMode = 'rb'):
     394def noxcptReadFile(sFile, sXcptRet, sMode = 'rb', sEncoding = 'utf-8'):
    395395    """
    396396    No exceptions common.readFile wrapper.
     
    400400    except:
    401401        sRet = sXcptRet;
     402    if sEncoding is not None:
     403        sRet = sRet.decode(sEncoding, 'ignore');
    402404    return sRet;
    403405
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