Catch except in file iteration so you can continue processing remaining files.

The next changes will be ground shaking, a lot should be changing,
performance should increase significantly.
This commit is contained in:
Brian 2014-05-09 15:21:56 -06:00
parent b3b960e9ef
commit 8d425d6413
2 changed files with 38 additions and 6 deletions

View File

@ -155,7 +155,17 @@ class Worker( threading.Thread ):
self.console.write( "Working on " + directory )
dir_contents = os.listdir( directory )
try:
dir_contents = os.listdir( directory )
except OSError as ex:
self.console.write( "| " + type( ex ).__name__ )
# args can be anything, can't guarantee they'll convert to a string
#self.console.write( "| " + ' '.join( [ str( arg ) for arg in ex.args ] ) )
self.console.write( "| " + repr( ex ) )
self.console.write( "|ERROR." )
self.console.flush( )
self.queue.task_done( )
continue
if p4_ignore in dir_contents:
file_regexes = []
@ -184,9 +194,10 @@ class Worker( threading.Thread ):
proc = subprocess.Popen( command.split( ), stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=directory )
(out, err) = proc.communicate()
except Exception as ex:
self.console.write( "| " + type( ex ) )
self.console.write( "| " + ex.args )
self.console.write( "| " + ex )
self.console.write( "| " + type( ex ).__name__ )
# args can be anything, can't guarantee they'll convert to a string
#self.console.write( "| " + ' '.join( [ str( arg ) for arg in ex.args ] ) )
self.console.write( "| " + repr( ex ) )
self.console.write( "|ERROR." )
self.console.flush( )
self.queue.task_done( )
@ -226,8 +237,13 @@ class Worker( threading.Thread ):
continue
self.console.write( "| " + file + " is unversioned, removing it." )
os.chmod( path, stat.S_IWRITE )
os.remove( path )
try:
os.chmod( path, stat.S_IWRITE )
os.remove( path )
except OSError as ex:
self.console.write( "| " + type( ex ).__name__ )
self.console.write( "| " + repr( ex ) )
self.console.write( "|ERROR." )
self.console.write( "|Done." )
self.console.flush( )

16
python2.7.exe.stackdump Normal file
View File

@ -0,0 +1,16 @@
Stack trace:
Frame Function Args
000FD4FC6C0 0018006F733 (FFFFFFFFFFFFFFFF, 006002C2510, 005CCDD1850, 005CCDD1870)
00000000006 00180070C6A (000FD4FC8A0, 00000000000, 0000000035C, 00000000000)
000FD4FC8A0 00180118778 (00000000000, 00000000000, 000FD4FCA20, 00600000003)
00000000041 0018011587E (00180133B2D, 000000002CC, 00000000000, 00000000000)
00000000000 00180115D4B (001801362C0, 006002C2270, 000775D19A1, 00000000006)
00000000000 00180115F1C (00000000000, 0008FB10544, 7FEFD6464DA, 006002C2318)
00000000000 001801161DF (0018013B2FB, 00600000001, 001801CA2C0, 000FD4FD640)
00000000000 00180144816 (00180135C7F, 006002C2270, 006002C2270, 006002C2270)
00000000000 001800BFCE3 (0018013460D, 00000000000, 005CCDB7127, 006002C2318)
00000000000 001801629FC (00000000000, 00000000000, 00000000000, 006002C2270)
00000000000 00180136AEF (00000000000, 00000000000, 00000000000, 00000000000)
00000000000 00180136334 (000003A0000, 00000000000, 00000000000, 00000000000)
00000000000 001800C373B (000003A0000, 00000000000, 00000000000, 00000000000)
End of stack trace