diff --git a/plugins/Python.py b/plugins/Python.py index 9ef6e5d7b..521af80f0 100644 --- a/plugins/Python.py +++ b/plugins/Python.py @@ -119,8 +119,11 @@ class Python(callbacks.Privmsg): if info[0] is not None: info[0].close() except ImportError: - irc.error(msg, 'No such module %s exists.' % name) - return + if parts == ['os', 'path']: + newmodule = os.path + else: + irc.error(msg, 'No such module %s exists.' % name) + return if hasattr(newmodule, functionName): f = getattr(newmodule, functionName) if hasattr(f, '__doc__'): diff --git a/test/test_Python.py b/test/test_Python.py index 693137e4e..f9822a448 100644 --- a/test/test_Python.py +++ b/test/test_Python.py @@ -50,6 +50,7 @@ class PythonTestCase(PluginTestCase, PluginDocumentation): self.assertNotError('pydoc socket.socket') self.assertNotError('pydoc logging.Logger') self.assertNotRegexp('pydoc str.replace', r"^'") + self.assertNotError('pydoc os.path.expanduser') def testZen(self): self.assertNotError('zen')