@@ -50,6 +50,13 @@ class AzureBatchConfig(object):
50
50
51
51
def __init__ (self ):
52
52
self ._data_dir = os .path .join (maya .prefs_dir (), 'AzureBatchData' )
53
+ if not os .path .isdir (self ._data_dir ):
54
+ try :
55
+ os .makedirs (self ._data_dir )
56
+ except OSError as exc : # Guard against race condition
57
+ if exc .errno != errno .EEXIST :
58
+ raise
59
+
53
60
self ._log = self ._configure_logging (LOG_LEVELS ['debug' ]) #config hasn't been loaded yet so use a default logging level
54
61
55
62
def initialize_ui (self , index , settings , frame , start , call ):
@@ -269,8 +276,6 @@ def _configure_plugin(self, from_auth_button):
269
276
"""Set up the config file, authenticate the SDK clients
270
277
and set up the log file.
271
278
"""
272
- if not os .path .exists (self ._data_dir ):
273
- os .makedirs (self ._data_dir )
274
279
config_file = os .path .join (self ._data_dir , self ._ini_file )
275
280
276
281
try :
@@ -415,7 +420,7 @@ def _configure_logging(self, log_level):
415
420
if len (logger .handlers ) == 0 :
416
421
file_format = logging .Formatter (
417
422
"%(asctime)-15s [%(levelname)s] %(module)s: %(message)s" )
418
- logfile = os .path .join (self ._data_dir , "azure_batch.log" )
423
+ logfile = os .path .normpath ( os . path . join (self ._data_dir , "azure_batch.log" ) )
419
424
if not os .path .exists (logfile ):
420
425
with open (logfile , 'w' ) as handle :
421
426
handle .write ("Azure Batch Plugin Log\n " )
0 commit comments