问题描述
我正在尝试使用脚本 in this wonderful medium post 从一堆 pdf 文件中抓取一些文本。我在 os.rename() 上的 pdf_extract 函数中收到一个错误,内容如下:
该进程无法访问该文件,因为它正被另一个进程使用:'C:\somepath\someppmfilename.ppm' -> 'C:\somepath\image0-0.ppm'"
def pdf_extract(myFile,i PATH):
print("extracting from file:",myFile)
delete_ppms(PATH)
images = pdf2image.convert_from_path(PATH + myFile,output_folder=PATH)
j = 0
for file in sorted (os.listdir(PATH)):
if '.ppm' in file and 'image' not in file:
os.rename(PATH + myFile,PATH + 'image' + str(i) + v'-' + str(j) + '.ppm'
j += 1
j = 0
解决方法
选择开始→输入搜索“资源监视器” 在 CPU 选项卡中找到“关联的句柄” 搜索您的流程路径
如何打开资源监视器。
{{3}}