mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-04 03:26:12 +02:00
Better handling of download errors.
This commit is contained in:
parent
7be6a27cb6
commit
eeb6c54b13
|
@ -180,12 +180,16 @@ def updateAllSources():
|
|||
print ( 'Updating source ' + source + ' from ' + updateURL )
|
||||
# Cross-python call
|
||||
updatedFile = getFileByUrl( updateURL );
|
||||
updatedFile = updatedFile.replace( '\r', '' ) #get rid of carriage-return symbols
|
||||
|
||||
# This is cross-python code
|
||||
dataFile = open( os.path.join( DATA_PATH, source, DATA_FILENAMES ), 'wb' )
|
||||
writeData( dataFile, updatedFile );
|
||||
dataFile.close()
|
||||
try:
|
||||
updatedFile = updatedFile.replace( '\r', '' ) #get rid of carriage-return symbols
|
||||
# This is cross-python code
|
||||
dataFile = open( os.path.join( DATA_PATH, source, DATA_FILENAMES ), 'wb' )
|
||||
writeData( dataFile, updatedFile );
|
||||
dataFile.close()
|
||||
except:
|
||||
print ( "Skipping." );
|
||||
|
||||
|
||||
def getUpdateURLFromFile( source ):
|
||||
pathToUpdateFile = os.path.join( DATA_PATH, source, UPDATE_URL_FILENAME )
|
||||
|
|
Loading…
Reference in New Issue
Block a user