fix possible sys.path bug

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-11-04 16:39:13 -05:00
parent c64d639dee
commit 634c8b88f1
1 changed files with 4 additions and 2 deletions

View File

@ -209,6 +209,7 @@ class PythonCheckSyntax(Method):
'''Check the syntax of the current python file'''
def _execute(self, w, **vargs):
pythonlib = w.application.config.get('python.lib')
old_path = sys.path
if pythonlib:
sys.path.insert(0, pythonlib)
source = w.buffer.make_string()
@ -217,9 +218,10 @@ class PythonCheckSyntax(Method):
w.set_error("Syntax OK")
except Exception, e:
output = traceback.format_exc()
w.application.data_buffer("*PythonSyntax*", output, switch_to=True,
w.application.data_buffer("*PythonSyntax*", output,
switch_to=True,
modename='error')
del sys.path[0]
sys.path = old_path
class PythonDictCleanup(Method):
'''Align assignment blocks and literal dictionaries'''