pyuno/source/loader/pythonloader.py | 2 +- scripting/source/pyprov/mailmerge.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit a76d229fa9d800e96d88f5f37981251722e153e6 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jan 27 07:18:20 2020 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jan 28 13:01:26 2020 +0100 sys.version is for displaying; use sys.version_info for version check Change-Id: If0d26019d9f842bcf56c1e01c46cc86c21523c3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87476 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py index 268cb168fe3c..5ce69f62ea7e 100644 --- a/pyuno/source/loader/pythonloader.py +++ b/pyuno/source/loader/pythonloader.py @@ -90,7 +90,7 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ): # read the file filename = unohelper.fileUrlToSystemPath( url ) - if sys.version >= '3': + if sys.version_info >= (3,0): fileHandle = open( filename, encoding='utf_8' ) else: fileHandle = open( filename ) diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 079744007816..fadceb1e1e56 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -127,7 +127,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() if user != '': - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: @@ -198,8 +198,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): except: #it's a bytesequence, get raw bytes textbody = textbody.value - if sys.version >= '3': - if sys.version_info.minor < 3 or (sys.version_info.minor == 3 and sys.version_info.micro <= 1): + if sys.version_info >= (3,0): + if sys.version_info <= (3,1): #http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w #see http://bugs.python.org/16564, etc. basically it now *seems* to be all ok #in python 3.3.2 onwards, but a little busted in 3.3.0 @@ -333,7 +333,7 @@ class PyMailIMAPService(unohelper.Base, XMailService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() if user != '': - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: @@ -411,7 +411,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService): user = xAuthenticator.getUserName() password = xAuthenticator.getPassword() - if sys.version < '3': # fdo#59249 i#105669 Python 2 needs "ascii" + if sys.version_info < (3,0): # fdo#59249 i#105669 Python 2 needs "ascii" user = user.encode('ascii') password = password.encode('ascii') if dbg: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits