Skip to content

Commit 2aee263

Browse files
committed
fix: change ast eval to regex operation
1 parent eb7a69d commit 2aee263

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

roboflow/core/project.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import ast
21
import datetime
32
import json
43
import os
4+
import re
55
import sys
66
import time
77
import warnings
@@ -553,7 +553,11 @@ def _annotation_params(self, annotation_path):
553553

554554
def _parse_upload_error(self, error: rfapi.UploadError) -> str:
555555
dict_part = str(error).split(": ", 2)[2]
556-
parsed_dict: dict = ast.literal_eval(dict_part)
556+
if re.search(r"'\w+':", dict_part):
557+
temp_str = dict_part.replace(r"\'", "<PLACEHOLDER>")
558+
temp_str = temp_str.replace("'", '"')
559+
dict_part = temp_str.replace("<PLACEHOLDER>", "'")
560+
parsed_dict: dict = json.loads(dict_part)
557561
message = parsed_dict.get("message")
558562
return message or str(parsed_dict)
559563

0 commit comments

Comments
 (0)