changeset 580:b7c432ce1b80

Project against absences of __file__.
author Simon Cross <hodgestar@gmail.com>
date Sun, 10 Apr 2011 15:06:50 +0200
parents e4242abff401
children 779c29924a8a
files scripts/skaapsteker
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/skaapsteker	Sun Apr 10 15:06:16 2011 +0200
+++ b/scripts/skaapsteker	Sun Apr 10 15:06:50 2011 +0200
@@ -2,7 +2,11 @@
 
 import os.path
 import sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+
+if '__file__' in globals():
+    # protect against missing __file__ in Windows executable scripts
+    # (in these cases, assume skaapsteker is already on the path)
+    sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
 
 import skaapsteker.__main__
 if __name__ == "__main__":