jobian commited on
Commit
ab48baa
·
1 Parent(s): 33b80e1

Fix datetime UTC import for Python 3.10 compatibility

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,7 +4,7 @@ import json
4
  import time
5
  import uuid
6
  import traceback
7
- from datetime import datetime, UTC
8
  from pathlib import Path
9
  from typing import List, Dict, Any, Tuple
10
 
@@ -232,7 +232,7 @@ def extract_tables(file_obj) -> Tuple[str, List[str], List[str], str]:
232
  # Still write empty outputs & metrics so downstream code doesn’t break
233
  json_obj = {
234
  "file": original_name,
235
- "extracted_at": datetime.now(UTC).isoformat().replace("+00:00", "Z"),
236
  "n_pages": n_pages,
237
  "tables": [],
238
  }
@@ -259,7 +259,7 @@ def extract_tables(file_obj) -> Tuple[str, List[str], List[str], str]:
259
  # Write JSON + metrics
260
  json_obj = {
261
  "file": original_name,
262
- "extracted_at": datetime.now(UTC).isoformat().replace("+00:00", "Z"),
263
  "n_pages": n_pages,
264
  "tables": all_tables_json,
265
  }
 
4
  import time
5
  import uuid
6
  import traceback
7
+ from datetime import datetime, timezone
8
  from pathlib import Path
9
  from typing import List, Dict, Any, Tuple
10
 
 
232
  # Still write empty outputs & metrics so downstream code doesn’t break
233
  json_obj = {
234
  "file": original_name,
235
+ "extracted_at": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
236
  "n_pages": n_pages,
237
  "tables": [],
238
  }
 
259
  # Write JSON + metrics
260
  json_obj = {
261
  "file": original_name,
262
+ "extracted_at": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
263
  "n_pages": n_pages,
264
  "tables": all_tables_json,
265
  }