Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

overlay: reorder imports, catch certain ImportErrors

It seems the overlay server can be started during an upgrade, which causes
some real havoc. Try to catch these errors and safely exit.

Traceback (most recent call last):
File "TortoiseHgOverlayServer.py", line 19, in <module>
File "win32event.pyo", line 12, in <module>
File "win32event.pyo", line 10, in __load
ImportError: DLL load failed: The process cannot access the file because it is being used by another process.

Changeset 604deb8ce2e0

Parent 733355d4abac

by Steve Borho

Changes to one file · Browse files at 604deb8ce2e0 Showing diff from parent 733355d4abac Diff from another changeset...

 
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
 
42
43
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
46
47
 
2
3
4
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
7
8
 
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
@@ -2,32 +2,7 @@
 # messages printed. Takes an optional logfile as first command  # line parameter   -import gc -import os  import sys -import time -import threading -import cStringIO -import Queue -import traceback - -from win32api import * -from win32gui import * - -import win32pipe -import win32con -import win32event -import win32file -import winerror -import pywintypes -import win32security - -from mercurial import demandimport -demandimport.ignore.append('win32com.shell') -demandimport.enable() -from mercurial import ui, error -from tortoisehg.util.i18n import agettext as _ -from tortoisehg.util import thread2, paths, shlib    if hasattr(sys, "frozen"):   class BlackHole(object): @@ -42,6 +17,35 @@
  sys.stdout = BlackHole()   sys.stderr = BlackHole()   +import os +import time +import threading +import cStringIO +import Queue +import traceback +import gc + +try: + from win32api import * + from win32gui import * + import win32pipe + import win32con + import win32event + import win32file + import winerror + import pywintypes + import win32security +except ImportError, e: + print 'Fatal error at startup', e + sys.exit(1) + +from mercurial import demandimport +demandimport.ignore.append('win32com.shell') +demandimport.enable() +from mercurial import ui, error +from tortoisehg.util.i18n import agettext as _ +from tortoisehg.util import thread2, paths, shlib +  APP_TITLE = _('TortoiseHg Overlay Icon Server')    EXIT_CMD = 1025