From 60ff4b8515874830e5047b9b235bbaf934b6a822 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 15 Feb 2015 22:00:49 +0100 Subject: [PATCH] Renamed commands/commands.py back to commands/command.py, it is confusing Python to import from inside a package with a module named the same as the package - since Python always searches the current directory first, it will try to import from the internal module and not from the external package, leading to not finding the contents of the package. This appears to be more a limitation of the package structure than with Evennia, so solving it the simplest way. --- evennia/commands/cmdsethandler.py | 6 +++--- evennia/game_template/commands/{commands.py => command.py} | 0 evennia/server/evennia_launcher.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename evennia/game_template/commands/{commands.py => command.py} (100%) diff --git a/evennia/commands/cmdsethandler.py b/evennia/commands/cmdsethandler.py index 343e37986f..6c2f0a7174 100644 --- a/evennia/commands/cmdsethandler.py +++ b/evennia/commands/cmdsethandler.py @@ -125,16 +125,16 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False): except ImportError, e: logger.log_trace() errstring += _("Error loading cmdset '%s': %s.") - errstring = errstring % (modulepath, e) + errstring = errstring % (python_path, e) except KeyError: logger.log_trace() errstring += _("Error in loading cmdset: No cmdset class '%(classname)s' in %(modulepath)s.") errstring = errstring % {"classname": classname, - "modulepath": modulepath} + "modulepath": python_path} except SyntaxError, e: logger.log_trace() errstring += _("SyntaxError encountered when loading cmdset '%s': %s.") - errstring = errstring % (modulepath, e) + errstring = errstring % (python_path, e) except Exception, e: logger.log_trace() errstring += _("Compile/Run error when loading cmdset '%s': %s.") diff --git a/evennia/game_template/commands/commands.py b/evennia/game_template/commands/command.py similarity index 100% rename from evennia/game_template/commands/commands.py rename to evennia/game_template/commands/command.py diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index 7e94186021..685eb12f04 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -59,7 +59,7 @@ TWISTED_MIN = '12.0' DJANGO_MIN = '1.7' DJANGO_REC = '1.7' -sys.path[0] = EVENNIA_ROOT +sys.path[1] = EVENNIA_ROOT #------------------------------------------------------------ # @@ -643,7 +643,7 @@ def init_game_directory(path, check_db=True): set_gamedir(path) # Add gamedir to python path - sys.path.insert(1, GAMEDIR) + sys.path.insert(0, GAMEDIR) if sys.argv[1] == 'test': os.environ['DJANGO_SETTINGS_MODULE'] = 'evennia.settings_default'