summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/gui/ui.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index e6c7d065..69b8463b 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -293,10 +293,13 @@ class UI(DisplayableContainer):
 				split = cwd.rsplit(os.sep, self.settings.shorten_title)
 				if os.sep in split[0]:
 					cwd = os.sep.join(split[1:])
-			fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
-					decode('utf-8', 'replace')
-			sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
-			sys.stdout.flush()
+			try:
+				fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
+						decode('utf-8', 'replace')
+				sys.stdout.write("\033]2;ranger:" + fixed_cwd + "\007")
+				sys.stdout.flush()
+			except:
+				pass
 		self.win.refresh()
 
 	def finalize(self):