From fd74a2cdf6228b25e4aefd0d6e491da64bad9fd5 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 29 Jan 2019 18:18:47 +0100 Subject: [PATCH] Auto-create zope_interface.__init__.py if missing. --- evennia/server/evennia_launcher.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index 5cd3cba524..83293be129 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -1273,6 +1273,19 @@ def check_main_evennia_dependencies(): error = True if error: sys.exit() + + # fix a common zope issue with a missing __init__ file + zope_interface = importlib.import_module("zope.interface") + expected_init_path = os.path.join( + os.path.dirname(os.path.dirname(zope_interface.__file__)), "__init__.py") + if not os.path.exists(expected_init_path): + # add an empty missing __init__.py file to fix the problem + with open(expected_init_path, 'w') as zope_init_file: + zope_init_file.write("") + print("Note: zope_interface.__init__.py not found. This is a known issue with that package." + "\nEvennia auto-created it at {}.".format( + expected_init_path)) + # return True/False if error was reported or not return not error