pan
commited on
Update replace_url.py
Browse files- replace_url.py +2 -3
replace_url.py
CHANGED
|
@@ -9,10 +9,8 @@ def replace_url_in_file(file_path, old_url, new_url):
|
|
| 9 |
|
| 10 |
with open(file_path, 'w', encoding='utf-8') as file:
|
| 11 |
file.write(filedata)
|
| 12 |
-
except UnicodeDecodeError:
|
| 13 |
-
print(f"Skipping file {file_path} due to decoding error.")
|
| 14 |
except Exception as e:
|
| 15 |
-
|
| 16 |
|
| 17 |
def replace_url_in_folder(folder_path, old_url, new_url):
|
| 18 |
for root, dirs, files in os.walk(folder_path):
|
|
@@ -27,5 +25,6 @@ old_git = "https://github.com"
|
|
| 27 |
new_git = "https://gh.con.sh/https://github.com"
|
| 28 |
replace_url_in_folder(folder_path, old_hugging, new_hugging)
|
| 29 |
replace_url_in_folder(folder_path, old_git, new_git)
|
|
|
|
| 30 |
|
| 31 |
|
|
|
|
| 9 |
|
| 10 |
with open(file_path, 'w', encoding='utf-8') as file:
|
| 11 |
file.write(filedata)
|
|
|
|
|
|
|
| 12 |
except Exception as e:
|
| 13 |
+
pass
|
| 14 |
|
| 15 |
def replace_url_in_folder(folder_path, old_url, new_url):
|
| 16 |
for root, dirs, files in os.walk(folder_path):
|
|
|
|
| 25 |
new_git = "https://gh.con.sh/https://github.com"
|
| 26 |
replace_url_in_folder(folder_path, old_hugging, new_hugging)
|
| 27 |
replace_url_in_folder(folder_path, old_git, new_git)
|
| 28 |
+
print("ALL DONE!")
|
| 29 |
|
| 30 |
|