diff --git a/mode/python.py b/mode/python.py index eada39a..aa634ec 100644 --- a/mode/python.py +++ b/mode/python.py @@ -212,7 +212,13 @@ class PythonSetLib(method.Method): class PythonCheckSyntax(method.Method): '''Check the syntax of the current python file''' def _execute(self, w, **vargs): - mod = os.path.splitext(os.path.basename(w.buffer.path))[0] + mod = os.path.splitext(w.buffer.path)[0] + cwd = os.getcwd() + '/' + if mod.startswith(cwd): + mod = mod.replace(cwd, '', 1) + else: + mod = os.path.basename(mod) + mod = mod.replace('/', '.') cmd = "PYTHONPATH=%s python -c 'import %s'" % (w.mode.pythonlib, mod) (status, output) = commands.getstatusoutput(cmd) if status == 0: