def do_init(): if not REDIRECT_OUTPUT: return global LOG_FILENAME from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: fix_unicode_out() return global LOG_FILENAME from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: if sys.version_info[0] < 3: #don't know why this breaks with Python 3 yet... fix_unicode_out() #figure out if we want to wait for input at the end: global _wait_for_input try: import win32console, win32con #@UnresolvedImport handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE) console_info = handle.GetConsoleScreenBufferInfo() cpos = console_info["CursorPosition"] #wait for input if this is a brand new console: _wait_for_input = cpos.X == 0 and cpos.Y == 0 except: e = sys.exc_info()[1] code = -1 try: code = e.winerror except: pass if code == errno.ENXIO: #ignore "no device" errors silently #(ie: happens if you redirect the command to a file) #we could also re-use the code above from "not_a_console()" pass else: print("error accessing console %s: %s" % (errno.errorcode.get(e.errno, e.errno), e)) if _wait_for_input: #don't wait for input when running under wine #(which usually does not popup a new shell window) try: import win32api #@UnresolvedImport hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, r"Software\\Wine") if hKey is not None: _wait_for_input = False except: #no wine key, assume not present and wait for input pass return from xpra.platform import get_prgname LOG_FILENAME = get_prgname() + ".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: if sys.version_info[0] < 3: #don't know why this breaks with Python 3 yet... fix_unicode_out() #figure out if we want to wait for input at the end: set_wait_for_input() return from xpra.platform import get_prgname LOG_FILENAME = (get_prgname() or "Xpra") + ".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: if sys.version_info[0]<3: #don't know why this breaks with Python 3 yet... fix_unicode_out() #figure out if we want to wait for input at the end: set_wait_for_input() return from xpra.platform import get_prgname LOG_FILENAME = (get_prgname() or "Xpra")+".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: if sys.version_info[0]<3: #don't know why this breaks with Python 3 yet... fix_unicode_out() #figure out if we want to wait for input at the end: global _wait_for_input try: import win32console, win32con #@UnresolvedImport handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE) console_info = handle.GetConsoleScreenBufferInfo() cpos = console_info["CursorPosition"] #wait for input if this is a brand new console: _wait_for_input = cpos.X==0 and cpos.Y==0 except: e = sys.exc_info()[1] code = -1 try: code = e.winerror except: pass if code==errno.ENXIO: #ignore "no device" errors silently #(ie: happens if you redirect the command to a file) #we could also re-use the code above from "not_a_console()" pass else: print("error accessing console %s: %s" % (errno.errorcode.get(e.errno, e.errno), e)) if _wait_for_input: #don't wait for input when running under wine #(which usually does not popup a new shell window) try: import win32api #@UnresolvedImport hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, r"Software\\Wine") if hKey is not None: _wait_for_input = False except: #no wine key, assume not present and wait for input pass return from xpra.platform import get_prgname LOG_FILENAME = get_prgname()+".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: FIX_UNICODE_OUT = envbool("XPRA_FIX_UNICODE_OUT", True) if PYTHON2 and FIX_UNICODE_OUT: #don't know why this breaks with Python 3 yet... fix_unicode_out() #figure out if we want to wait for input at the end: set_wait_for_input() return from xpra.platform import get_prgname LOG_FILENAME = (get_prgname() or "Xpra") + ".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout
def do_init(): if not REDIRECT_OUTPUT: fix_unicode_out() #figure out if we want to wait for input at the end: global _wait_for_input try: import win32console, win32con #@UnresolvedImport handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE) console_info = handle.GetConsoleScreenBufferInfo() cpos = console_info["CursorPosition"] #wait for input if this is a brand new console: _wait_for_input = cpos.X==0 and cpos.Y==0 except Exception, e: print("error accessing console: %s" % e) return from xpra.platform import get_prgname LOG_FILENAME = get_prgname()+".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout def do_clean(): global _wait_for_input if _wait_for_input: print("\nPress Enter to close") sys.stdin.readline()
def do_init(): if not REDIRECT_OUTPUT: fix_unicode_out() #figure out if we want to wait for input at the end: global _wait_for_input try: import win32console, win32con #@UnresolvedImport handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE) console_info = handle.GetConsoleScreenBufferInfo() cpos = console_info["CursorPosition"] #wait for input if this is a brand new console: _wait_for_input = cpos.X == 0 and cpos.Y == 0 except Exception, e: print("error accessing console: %s" % e) return from xpra.platform import get_prgname LOG_FILENAME = get_prgname() + ".log" from paths import _get_data_dir d = _get_data_dir() log_file = os.path.join(d, LOG_FILENAME) sys.stdout = open(log_file, "a") sys.stderr = sys.stdout def do_clean(): global _wait_for_input if _wait_for_input: print("\nPress Enter to close") sys.stdin.readline()