summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/__main__.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index a3e0ef1c..ac6b2362 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -21,6 +21,7 @@
 # (ImportError will imply that this module can't be found)
 # convenient exception handling in ranger.py (ImportError)
 
+import locale
 import os
 import sys
 
@@ -152,7 +153,18 @@ def main():
 		print(errormessage)
 		print('ranger requires the python curses module. Aborting.')
 		sys.exit(1)
-	import locale
+
+	try: locale.setlocale(locale.LC_ALL, '')
+	except: print("Warning: Unable to set locale.  Expect encoding problems.")
+
+	if not 'SHELL' in os.environ:
+		os.environ['SHELL'] = 'bash'
+
+	arg = parse_arguments()
+	if arg.clean:
+		sys.dont_write_bytecode = True
+
+	# Need to decide whether to write bytecode or not before importing.
 	import ranger
 	from ranger.ext import curses_interrupt_handler
 	from ranger.core.runner import Runner
@@ -163,17 +175,9 @@ def main():
 	from ranger.shared import (EnvironmentAware, FileManagerAware,
 			SettingsAware)
 
-	try: locale.setlocale(locale.LC_ALL, '')
-	except: print("Warning: Unable to set locale.  Expect encoding problems.")
-
-	if not 'SHELL' in os.environ:
-		os.environ['SHELL'] = 'bash'
-
-	arg = parse_arguments()
-	ranger.arg = arg
-
-	if not ranger.arg.debug:
+	if not arg.debug:
 		curses_interrupt_handler.install_interrupt_handler()
+	ranger.arg = arg
 
 	SettingsAware._setup()
 
vabit.com> 2010-03-12 00:46:46 +0100 added documentation on how colorschemes work' href='/akspecs/ranger/commit/doc/colorschemes.txt?h=v1.2.1&id=efdc7b16e9f422f2d95271e6d4bf64dd9a03ea33'>efdc7b16 ^
a8f9cf2c ^

efdc7b16 ^

a2853ab6 ^
efdc7b16 ^






a2853ab6 ^
efdc7b16 ^







a8f9cf2c ^

efdc7b16 ^














1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101