Commits

AJ R committed eca7d39 Merge

Merged in the_lo_ni_us/savreaderwriter (pull request #2)

hacked quick and dirty to work with cx_freeze et. al...

Comments (0)

Files changed (2)

savReaderWriter/__init__.py

     cWriterowOK = False
 
 __author__ = "Albert-Jan Roskam" + " " + "@".join(["fomcl", "yahoo.com"])
-__version__ = open(os.path.join(os.path.dirname(__file__),
-                                "VERSION")).read().strip()
 
+if getattr(sys, 'frozen', False):
+    # The application is frozen by cx_freeze, py2exe or something
+    __version__ = open(os.path.join(os.path.dirname(sys.executable),
+                        "savReaderWriter", "VERSION")).read().strip()
+else:
+    __version__ = open(os.path.join(os.path.dirname(__file__),
+                        "VERSION")).read().strip()
 
 allFormats = {
     1: ("SPSS_FMT_A", "Alphanumeric"),

savReaderWriter/generic.py

         # Using regex patterns ought to be more resilient to updates of the
         # I/O modules, compared to hardcoding the names
         debug = False
-        path = os.path.join(os.path.dirname(__file__), "spssio", folder)
+        if getattr(sys, 'frozen', False):
+            # The application is frozen by cx_freeze, py2exe or something
+            path = os.path.join(os.path.dirname(sys.executable), "savReaderWriter", "spssio", folder)
+        else:
+            path = os.path.join(os.path.dirname(__file__), "spssio", folder)
         libs = sorted(os.listdir(path))
         pats = ['(lib)?icuda?t', '(lib)?icuuc', '(lib)?icui',
                 '(lib)?zlib', '(lib)?spssd?io', '(lib)?spssjdio']