Add error handling and verification for encodings.py copy operation
Browse files- adapter.py +10 -2
adapter.py
CHANGED
|
@@ -99,8 +99,16 @@ if os.path.exists(encodings_src):
|
|
| 99 |
os.makedirs('ablang2/pretrained_utils', exist_ok=True)
|
| 100 |
dst = 'ablang2/pretrained_utils/encodings.py'
|
| 101 |
print(f"π Copying {encodings_src} to {dst}")
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
else:
|
| 105 |
print("β ablang_encodings.py not found!")
|
| 106 |
|
|
|
|
| 99 |
os.makedirs('ablang2/pretrained_utils', exist_ok=True)
|
| 100 |
dst = 'ablang2/pretrained_utils/encodings.py'
|
| 101 |
print(f"π Copying {encodings_src} to {dst}")
|
| 102 |
+
try:
|
| 103 |
+
shutil.copy2(encodings_src, dst)
|
| 104 |
+
print("β
Copied ablang_encodings.py as encodings.py for compatibility")
|
| 105 |
+
# Verify the copy worked
|
| 106 |
+
if os.path.exists(dst):
|
| 107 |
+
print(f"β
Verified {dst} exists after copy")
|
| 108 |
+
else:
|
| 109 |
+
print(f"β {dst} does not exist after copy!")
|
| 110 |
+
except Exception as e:
|
| 111 |
+
print(f"β Error copying file: {e}")
|
| 112 |
else:
|
| 113 |
print("β ablang_encodings.py not found!")
|
| 114 |
|