From 1f11bef4a31e9977810b134b74b60dcea87a2e68 Mon Sep 17 00:00:00 2001 From: Phil <phil@secdev.org> Date: Thu, 21 Feb 2008 19:19:29 +0100 Subject: [PATCH] Fixed load_extension() error management --- scapy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scapy.py b/scapy.py index 5bc4110f..a24f725c 100755 --- a/scapy.py +++ b/scapy.py @@ -897,6 +897,7 @@ def load_extension(filename): thename = thename[:-3] paths.insert(0, thepath) + cwd=syspath=None try: cwd = os.getcwd() os.chdir(thepath) @@ -911,8 +912,10 @@ def load_extension(filename): import __builtin__ __builtin__.__dict__.update(ext.__dict__) finally: - sys.path=syspath - os.chdir(cwd) + if syspath: + sys.path=syspath + if cwd: + os.chdir(cwd) -- GitLab