mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-10-05 14:21:03 +01:00
Better handling of download errors.
This commit is contained in:
+9
-5
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user