diff scripts/skaapsteker @ 580:b7c432ce1b80

Project against absences of __file__.
author Simon Cross <hodgestar@gmail.com>
date Sun, 10 Apr 2011 15:06:50 +0200
parents 6f1e43d2fda8
children
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__":