Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing message when trying importing an unexisting module

  • Loading branch information...
commit 31f5d8f79e3fe4469f4b7bc0e81b3751302ae8c8 1 parent 42ec214
@heynemann authored
Showing with 13 additions and 1 deletion.
  1. +5 −0 ion/console/providers.py
  2. +8 −1 ion/context.py
View
5 ion/console/providers.py
@@ -167,6 +167,11 @@ def execute(self, current_dir, options, args, complement_dir=None):
tests_dirs = []
for app in context.apps:
module = imp(app)
+
+ if not module:
+ log('Cannot import module [%s]' % app)
+ sys.exit(0)
+
module_path = dirname(inspect.getfile(module))
if complement_dir:
View
9 ion/context.py
@@ -18,6 +18,8 @@
import inspect
from os.path import join, dirname, splitext, split, exists
+import cherrypy
+
from bus import Bus
from settings import Settings
from fs import imp, locate, is_file
@@ -39,7 +41,12 @@ def load_apps(self):
self.app_modules = {}
for app in self.apps:
- self.app_modules[app] = imp(app)
+ module = imp(app)
+ if not module:
+ cherrypy.log.error('Cannot import module from %s.' % app, 'Server')
+ sys.exit(0)
+
+ self.app_modules[app] = module
app_path = dirname(inspect.getfile(self.app_modules[app]))
self.app_paths[app] = app_path
Please sign in to comment.
Something went wrong with that request. Please try again.