From c1e70f798c4ff3ceb5c5aff31e9d0c448eff8665 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 27 Jul 2018 15:36:59 +0300 Subject: [PATCH] UserWarning when importing on Python <3 https://python3statement.org/practicalities/#runtime-warning-on-master --- pylast/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pylast/__init__.py b/pylast/__init__.py index d5622c2..3061d3d 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -30,6 +30,7 @@ import ssl import sys import tempfile import time +import warnings import xml.dom from . import version @@ -42,6 +43,12 @@ __license__ = "apache2" __email__ = "amr.hassan@gmail.com" __version__ = version.__version__ +if sys.version_info < (3,): + warnings.warn('You are using pylast with Python 2. ' + 'Pylast will soon be Python 3 only. ' + 'More info: https://github.com/pylast/pylast/issues/265', + UserWarning) + if sys.version_info.major == 2: import htmlentitydefs from httplib import HTTPSConnection