Commit e807472e authored by Saul Ibarra's avatar Saul Ibarra

Store output in user's home directory when frozen

parent 1b0776ae
...@@ -21,8 +21,12 @@ if os.path.basename(script_dir)=='bin' and os.path.exists(os.path.join(parent_di ...@@ -21,8 +21,12 @@ if os.path.basename(script_dir)=='bin' and os.path.exists(os.path.join(parent_di
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
# Override stdout and stderr, save output to a file try:
sys.stdout = sys.stderr = open(sys.executable + '.log', 'a') from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
# Override stdout and stderr, save output to a StringIO object, then to a file
sys.stdout = sys.stderr = StringIO()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -56,6 +56,13 @@ from blink.update import UpdateManager ...@@ -56,6 +56,13 @@ from blink.update import UpdateManager
from blink.util import QSingleton, run_in_gui_thread from blink.util import QSingleton, run_in_gui_thread
if getattr(sys, 'frozen', False):
output = sys.stdout
sys.stdout = sys.stderr = open(ApplicationData.get('logs/output.log'), 'a')
sys.stdout.write(output.getvalue())
output.close()
class IPAddressMonitor(object): class IPAddressMonitor(object):
""" """
An object which monitors the IP address used for the default route of the An object which monitors the IP address used for the default route of the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment