Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pdb提示符只是退出,没有任何交互响应_Python_Pandas_Debugging_Pdb - Fatal编程技术网

Python pdb提示符只是退出,没有任何交互响应

Python pdb提示符只是退出,没有任何交互响应,python,pandas,debugging,pdb,Python,Pandas,Debugging,Pdb,我正在运行一个脚本main.py,如果if语句正确,它将转到另一个函数tsv\u image\u conversion,并且在tsv\u image\u conversion函数中,我保存pytesseract的tsv输出,然后尝试使用pandas从tsv文件中获取值,但当我放入导入pdb时;pdb.set_trace()在我的代码中,我遇到pdb退出而没有任何交互,而且,如果我在一些布尔屏蔽后试图打印dataframe中的值,我不会得到任何打印输出或任何错误 附言:我正在使用一个名为ocr的c

我正在运行一个脚本main.py,如果
if
语句正确,它将转到另一个函数
tsv\u image\u conversion
,并且在
tsv\u image\u conversion
函数中,我保存
pytesseract
tsv
输出,然后尝试使用
pandas
tsv文件中获取值,但当我放入
导入pdb时;pdb.set_trace()
在我的代码中,我遇到pdb退出而没有任何交互,而且,如果我在一些布尔屏蔽后试图打印
dataframe
中的值,我不会得到任何打印输出或任何错误

附言:我正在使用一个名为ocrconda环境

无法理解为什么会发生这种情况:

我在这里给出了一些tsv图像转换的代码:

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] 

听起来你的翻译好像碰到了一个bug然后死了。尝试基本上
pip安装snoop
import snoop
,然后
@snoop
上面
def tsv\u image\u转换
@AlexHall:你能解释一下这意味着什么吗:我的python解释器遇到了一个bug,就死了。
$ 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