diff --git a/plugins/Python.py b/plugins/Python.py index 6b1fde738..57026bb29 100644 --- a/plugins/Python.py +++ b/plugins/Python.py @@ -53,7 +53,10 @@ import utils import privmsgs import callbacks -pythonPath = map(os.path.dirname, [os.__file__, math.__file__]) +L = [os.__file__] +if hasattr(math, '__file__'): + L.append(math.__file__) +pythonPath = map(os.path.dirname, L) def configure(onStart, afterConnect, advanced): # This will be called by setup.py to configure this module. onStart and diff --git a/test/test_Python.py b/test/test_Python.py index 65d39886b..13cc77cba 100644 --- a/test/test_Python.py +++ b/test/test_Python.py @@ -42,7 +42,8 @@ class PythonTestCase(PluginTestCase, PluginDocumentation): if os.name == 'posix': self.assertNotRegexp('pydoc crypt.crypt', 'NameError') self.assertNotError('pydoc crypt.crypt') - self.assertNotError('pydoc math.sin') + # .so modules don't have an __file__ in Windows. + self.assertNotError('pydoc math.sin') self.assertNotError('pydoc string.translate') self.assertNotError('pydoc fnmatch.fnmatch') self.assertNotError('pydoc socket.socket')