Notify that Python needs upgrading when requests can't be imported
This commit is contained in:
parent
149ab8d00e
commit
df7bf5cddb
1 changed files with 12 additions and 4 deletions
|
@ -34,8 +34,19 @@ from .constants import (
|
||||||
MALFORMED_HEARTBEAT_ERROR,
|
MALFORMED_HEARTBEAT_ERROR,
|
||||||
)
|
)
|
||||||
from .logger import setup_logging
|
from .logger import setup_logging
|
||||||
|
|
||||||
|
log = logging.getLogger('WakaTime')
|
||||||
|
|
||||||
|
try:
|
||||||
|
from .packages import requests
|
||||||
|
except ImportError:
|
||||||
|
log.traceback(logging.ERROR)
|
||||||
|
print(traceback.format_exc())
|
||||||
|
log.error('Please upgrade Python to the latest version.')
|
||||||
|
print('Please upgrade Python to the latest version.')
|
||||||
|
sys.exit(UNKNOWN_ERROR)
|
||||||
|
|
||||||
from .offlinequeue import Queue
|
from .offlinequeue import Queue
|
||||||
from .packages import requests
|
|
||||||
from .packages.requests.exceptions import RequestException
|
from .packages.requests.exceptions import RequestException
|
||||||
from .project import get_project_info
|
from .project import get_project_info
|
||||||
from .session_cache import SessionCache
|
from .session_cache import SessionCache
|
||||||
|
@ -48,9 +59,6 @@ except (ImportError, SyntaxError): # pragma: nocover
|
||||||
from .packages import tzlocal
|
from .packages import tzlocal
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger('WakaTime')
|
|
||||||
|
|
||||||
|
|
||||||
def send_heartbeat(project=None, branch=None, hostname=None, stats={}, key=None,
|
def send_heartbeat(project=None, branch=None, hostname=None, stats={}, key=None,
|
||||||
entity=None, timestamp=None, is_write=None, plugin=None,
|
entity=None, timestamp=None, is_write=None, plugin=None,
|
||||||
offline=None, entity_type='file', hidefilenames=None,
|
offline=None, entity_type='file', hidefilenames=None,
|
||||||
|
|
Loading…
Reference in a new issue