File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 25
25
26
26
import glob
27
27
import os
28
+ import platform
28
29
import sys
29
30
from .utils .compat import PY3 , WIDE_CHARS , a2u
30
31
from .exceptions import SWATError
@@ -137,11 +138,24 @@ def InitializeTK(*args, **kwargs):
137
138
''' Initialize the TK subsystem (importing _pyswat as needed) '''
138
139
if _pyswat is None :
139
140
_import_pyswat ()
140
- out = _pyswat .InitializeTK (* args , ** kwargs )
141
- # Override TKPATH after initialization so that other TK applications
142
- # won't be affected.
143
- if sys .platform .lower ().startswith ('win' ) and 'TKPATH' not in os .environ :
144
- os .environ ['TKPATH' ] = os .pathsep
141
+
142
+ # Patch ppc linux path
143
+ set_tkpath_env = 'ppc' in platform .machine () and 'TKPATH' not in os .environ
144
+ if set_tkpath_env and args :
145
+ os .environ ['TKPATH' ] = args [0 ]
146
+
147
+ try :
148
+ out = _pyswat .InitializeTK (* args , ** kwargs )
149
+
150
+ finally :
151
+ if set_tkpath_env :
152
+ del os .environ ['TKPATH' ]
153
+
154
+ # Override TKPATH after initialization so that other TK applications
155
+ # won't be affected (Windows only).
156
+ if sys .platform .lower ().startswith ('win' ) and 'TKPATH' not in os .environ :
157
+ os .environ ['TKPATH' ] = os .pathsep
158
+
145
159
return out
146
160
147
161
You can’t perform that action at this time.
0 commit comments