VirtualBox

Ignore:
Timestamp:
Jan 12, 2018 6:25:48 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120253
Message:

testboxdriver,testboxscript: Python3 updates.

Location:
trunk/src/VBox/ValidationKit/testboxscript
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testboxscript/testboxconnection.py

    r70560 r70566  
    3232# Standard python imports.
    3333import sys;
    34 import urllib
    3534if sys.version_info[0] >= 3:
    36     import http.client as httplib;      # pylint: disable=import-error,no-name-in-module
    37     import urllib.parse as urlparse;    # pylint: disable=import-error,no-name-in-module
     35    import http.client as httplib;                          # pylint: disable=import-error,no-name-in-module
     36    import urllib.parse as urlparse;                        # pylint: disable=import-error,no-name-in-module
     37    from urllib.parse import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module
    3838else:
    39     import httplib;                     # pylint: disable=import-error
    40     import urlparse;                    # pylint: disable=import-error
     39    import httplib;                                         # pylint: disable=import-error
     40    import urlparse;                                        # pylint: disable=import-error
     41    from urllib import urlencode as urllib_urlencode;       # pylint: disable=import-error
    4142
    4243# Validation Kit imports.
     
    5960            # Read the whole response (so we can log it).
    6061            sBody = oResponse.read();
     62            sBody = sBody.decode('utf-8');
    6163
    6264            # Check the content type.
     
    199201        sServerPath = '/%s/testboxdisp.py' % (self._oParsedUrl.path.strip('/'),); # pylint: disable=E1101
    200202        dParams[constants.tbreq.ALL_PARAM_ACTION] = sAction;
    201         sBody = urllib.urlencode(dParams);
     203        sBody = urllib_urlencode(dParams);
    202204        ##testboxcommons.log2('sServerPath=%s' % (sServerPath,));
    203205        try:
  • trunk/src/VBox/ValidationKit/testboxscript/testboxtasks.py

    r70548 r70566  
    642642            oFile = open(sPath, "rb");
    643643            sStr = oFile.read();
     644            sStr = sStr.decode('utf-8');
    644645            oFile.close();
    645646            return sStr.strip();
     
    779780        try:
    780781            oFile = open(sPath, "wb");
    781             oFile.write(sContent);
     782            oFile.write(sContent.encode('utf-8'));
    782783            oFile.flush();
    783784            try:     os.fsync(oFile.fileno());
Note: See TracChangeset for help on using the changeset viewer.

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