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( )