From 20d6de51045a3639e96c378c9f34f4ab30e550bb Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 28 Oct 2012 14:38:17 +0100 Subject: [PATCH] Made a better check for cleaning module names, should resolve Issue 319. --- src/commands/default/general.py | 3 ++- src/utils/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/default/general.py b/src/commands/default/general.py index 627d4a24e..0bf5e5050 100644 --- a/src/commands/default/general.py +++ b/src/commands/default/general.py @@ -281,7 +281,8 @@ class CmdGet(MuxCommand): if caller == obj: caller.msg("You can't get yourself.") return - if obj.location == caller: + print obj, obj.location, caller, caller==obj.location + if caller == obj.location: caller.msg("You already hold that.") return if not obj.access(caller, 'get'): diff --git a/src/utils/utils.py b/src/utils/utils.py index 189e3efef..a274e96c0 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -6,7 +6,7 @@ be of use when designing your own game. """ -import os, sys, imp, types, math +import os, sys, imp, types, math, re import textwrap, datetime, random from inspect import ismodule from collections import defaultdict @@ -837,7 +837,7 @@ def mod_import(module): if not os.path.isabs(module): module = os.path.abspath(module) path, filename = module.rsplit(os.path.sep, 1) - modname = filename.rstrip('.py') + modname = re.sub(r"\.py$", "", filename) try: result = imp.find_module(modname, [path])