From 51dc4f4b05650f2ac2d3f327130e78a3369d9df8 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 19 Jan 2011 23:31:14 +0300 Subject: [PATCH] Make config.py a bit more executable-friendly --- config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 0789ffa21..73921c6a6 100644 --- a/config.py +++ b/config.py @@ -14,8 +14,13 @@ expansionVersion = "1.1.0" # The main pyfa directory which contains run.py # Python 2.X uses ANSI by default, so we need to convert the character encoding -pyfaPath = unicode(os.path.dirname(os.path.abspath(sys.modules['__main__'].__file__)), - sys.getfilesystemencoding()) +try: + pyfaPath = unicode(os.path.dirname(os.path.abspath(sys.modules['__main__'].__file__)), + sys.getfilesystemencoding()) +# We don't have __file__ attribute of module __main__ for some cases (like frozen +# win32 executable) +except AttributeError: + pyfaPath = None # Where we store the saved fits etc, default is the current users home directory savePath = unicode(os.path.expanduser(os.path.join("~", ".pyfa")),