From 6ba1b170d2af95d2cfd61a1bbcae65e0a513d647 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 15 Aug 2018 14:02:44 -0400 Subject: [PATCH] provide friendlier help messages if you set up custom venvs wrong --- awx/lib/awx_display_callback/cleanup.py | 7 ++++++- awx/lib/awx_display_callback/events.py | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/awx/lib/awx_display_callback/cleanup.py b/awx/lib/awx_display_callback/cleanup.py index 8926e54f72..497401feea 100644 --- a/awx/lib/awx_display_callback/cleanup.py +++ b/awx/lib/awx_display_callback/cleanup.py @@ -24,7 +24,12 @@ import os import pwd # PSUtil -import psutil +try: + import psutil +except ImportError: + raise ImportError('psutil is missing; {}bin/pip install psutil'.format( + os.environ['VIRTUAL_ENV'] + )) __all__ = [] diff --git a/awx/lib/awx_display_callback/events.py b/awx/lib/awx_display_callback/events.py index ca801925f5..d22b93b8e4 100644 --- a/awx/lib/awx_display_callback/events.py +++ b/awx/lib/awx_display_callback/events.py @@ -27,7 +27,13 @@ import os import stat import threading import uuid -import memcache + +try: + import memcache +except ImportError: + raise ImportError('python-memcached is missing; {}bin/pip install python-memcached'.format( + os.environ['VIRTUAL_ENV'] + )) from six.moves import xrange