我正在运行一个脚本main.pytsv_image_conversion
,如果if
语句正确,它会转到另一个函数,并且在tsv_image_conversion
函数中,我保存tsv
输出pytesseract
,然后尝试使用从tsv 文件pandas
中获取值,但是当我放入我的代码,我遇到pdb在没有任何交互性的情况下退出,而且,如果我试图在一些布尔掩码之后打印值,我不会得到任何打印输出或任何错误。import pdb; pdb.set_trace()
dataframe
PS:我正在使用一个名为ocr的conda环境。
无法理解为什么会这样:
我在tsv_image_conversion
这里给出一些代码:
def tsv_image_conversion(idx, start_word, end_word):
with open('tsv_out.tsv', 'w') as f:
f.write(pytesseract.image_to_data(Image.open(f'out{idx}.jpg')))
print(os.getcwd())
sdf = pd.read_csv('tsv_out.tsv', sep='\t')
index1 = sdf[sdf['text'] == start_word].index.values[0]
index2 = sdf[sff['text'] == end_word].index.values[0]
$ python main.py
Index(['_id', 'backup', 'case_no', 'data_inserted_on', 'elastic', 'event_id',
'link', 'md5', 'pdf_link', 'pdf_url', 'registration_date',
'registration_location', 's3_pdf_link', 's_no', 'sisyphean_id',
'status'],
dtype='object')
1 md5: 5db95d6393cf281daf39079a
/home/aspiring1/.Private/block_extraction/5db95d6393cf281daf39079a
> /home/aspiring1/.Private/block_extraction/5db95d6393cf281daf39079a/main.py(26)tsv_image_conversion()
(Pdb)
(ocr) $Private/block_extraction$ vim +80 main.py