PaddlePaddle/PaddleOCR · error · Exception
{} does not exist!
Error message
{} does not exist! What it means
The PubTabNet table-recognition dataset reads JSONL annotations (filename, html.cells, html.structure.tokens), joins data_dir with info['filename'], and raises Exception('{path} does not exist!') when the table image is absent. The bare except then logs and skips the sample.
Source
Thrown at ppocr/data/pubtab_dataset.py:106
def shuffle_data_random(self):
if self.do_shuffle:
random.seed(self.seed)
random.shuffle(self.data_lines)
return
def __getitem__(self, idx):
try:
data_line = self.data_lines[idx]
data_line = data_line.decode("utf-8").strip("\n")
info = json.loads(data_line)
file_name = info["filename"]
cells = info["html"]["cells"].copy()
structure = info["html"]["structure"]["tokens"].copy()
img_path = os.path.join(self.data_dir, file_name)
if not os.path.exists(img_path):
raise Exception("{} does not exist!".format(img_path))
data = {
"img_path": img_path,
"cells": cells,
"structure": structure,
"file_name": file_name,
}
with open(data["img_path"], "rb") as f:
img = f.read()
data["image"] = img
outs = transform(data, self.ops)
except:
import traceback
err = traceback.format_exc()
self.logger.error(
"When parsing line {}, error happened with msg: {}".format(
data_line, errView on GitHub (pinned to 2661c7c0ef)
Solutions
- Verify one entry: python -c 'import json,os; i=json.loads(open("train.jsonl").readline()); print(os.path.exists(os.path.join(data_dir, i["filename"])))'
- Set data_dir in the table yml to the directory containing the images referenced by filename
- Download/restore the missing image splits from the PubTabNet distribution
- If the layout differs, rewrite the JSONL filenames with a small script instead of moving gigabytes of images
Example fix
# before (config) data_dir: ./train_data/pubtabnet # after (images live one level down) data_dir: ./train_data/pubtabnet/train_images
Defensive patterns
Strategy: validation
Validate before calling
import json, os
for line in open(jsonl_path, encoding='utf-8'):
fn = json.loads(line)['filename']
if not os.path.exists(os.path.join(data_dir, fn)):
raise SystemExit(f'{fn} missing under {data_dir}') Try / catch
try:
out = dataset[idx]
except Exception:
out = None # logged and skipped upstream; monitor skip rate Prevention
- Download both the PubTabNet images and JSONL and keep the documented layout
- Set data_dir to the image root, not the annotation root
- Run a JSONL lint pass after any restructuring
When it happens
Trigger: Training/evaluating PP-Structure table models with a PubTabNet JSONL whose 'filename' entries do not resolve under data_dir: images not downloaded, data_dir wrong, or filename containing a subdirectory that was flattened on unzip.
Common situations: Downloading PubTabNet JSONL but not the image archive; using val.jsonl with train images only; data_dir pointing at the JSONL folder instead of the image folder.
Related errors
- {} does not exist!
- {} does not exist!
- Missing LMDB dataset value
- RecResizeImg.image_shape is required in rec inference.yml
- Unexpected recognition channels: ${String(channels)}
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/8963658006caeefe.
Report an issue: GitHub.