File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,8 @@ def _handle_load_data_infile(self, filename):
435
435
"""Handle a LOAD DATA INFILE LOCAL request"""
436
436
try :
437
437
data_file = open (filename , 'rb' )
438
+ return self ._handle_ok (self ._send_data (data_file ,
439
+ send_empty_packet = True ))
438
440
except IOError :
439
441
# Send a empty packet to cancel the operation
440
442
try :
@@ -444,9 +446,11 @@ def _handle_load_data_infile(self, filename):
444
446
"MySQL Connection not available." )
445
447
raise errors .InterfaceError (
446
448
"File '{0}' could not be read" .format (filename ))
447
-
448
- return self ._handle_ok (self ._send_data (data_file ,
449
- send_empty_packet = True ))
449
+ finally :
450
+ try :
451
+ data_file .close ()
452
+ except (IOError , NameError ):
453
+ pass
450
454
451
455
def _handle_result (self , packet ):
452
456
"""Handle a MySQL Result
You can’t perform that action at this time.
0 commit comments