首先我在安装的时候报错,后来删了在requirements.txt里的指定版本才安装成功,看来其中一些插件的旧版本已经不提供安装。
然后在使用过程中也报错了,log如下
D:\Program Files Green\ChangePDFContrast>"D:\Program Files Green\ChangePDFContrast\main.py"
======第一步:分解=====
正在调用PDF转PIL数组的库函数,如果你电脑内存太小且PDF太大,有可能内存崩掉,那跟我没关系,自己找pdf2img的作者哭去,反正我32G不慌...
耐心等一会儿...
分解完成,用时0.94秒
======第二步:图片处理=====
正在处理第1张图片...
D:\Program Files Green\ChangePDFContrast\pdf_enhance.py:18: RuntimeWarning: overflow encountered in scalar add
LUT[range_min:range_max+1]=np.linspace(start=0,stop=255,num=(range_max-range_min)+1,endpoint=True,dtype=np.uint8)
Traceback (most recent call last):
File "D:\Program Files Green\ChangePDFContrast\main.py", line 59, in
resImg = pdfenhance(img, contrast_level)
File "D:\Program Files Green\ChangePDFContrast\pdf_enhance.py", line 18, in pdfenhance
LUT[range_min:range_max+1]=np.linspace(start=0,stop=255,num=(range_max-range_min)+1,endpoint=True,dtype=np.uint8)
ValueError: could not broadcast input array from shape (123,) into shape (0,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\shutil.py", line 618, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\tempfile.py", line 843, in onerror
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Program Files Green\ChangePDFContrast\main.py", line 49, in
with tempfile.TemporaryDirectory() as path:
File "C:\Program Files\Python310\lib\tempfile.py", line 869, in exit
self.cleanup()
File "C:\Program Files\Python310\lib\tempfile.py", line 873, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 620, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Program Files\Python310\lib\tempfile.py", line 846, in onerror
cls._rmtree(path, ignore_errors=ignore_errors)
File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 601, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\Program Files\Python310\lib\shutil.py", line 598, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'
首先我在安装的时候报错,后来删了在requirements.txt里的指定版本才安装成功,看来其中一些插件的旧版本已经不提供安装。
然后在使用过程中也报错了,log如下
D:\Program Files Green\ChangePDFContrast>"D:\Program Files Green\ChangePDFContrast\main.py"
======第一步:分解=====
正在调用PDF转PIL数组的库函数,如果你电脑内存太小且PDF太大,有可能内存崩掉,那跟我没关系,自己找pdf2img的作者哭去,反正我32G不慌...
耐心等一会儿...
分解完成,用时0.94秒
======第二步:图片处理=====
正在处理第1张图片...
D:\Program Files Green\ChangePDFContrast\pdf_enhance.py:18: RuntimeWarning: overflow encountered in scalar add
LUT[range_min:range_max+1]=np.linspace(start=0,stop=255,num=(range_max-range_min)+1,endpoint=True,dtype=np.uint8)
Traceback (most recent call last):
File "D:\Program Files Green\ChangePDFContrast\main.py", line 59, in
resImg = pdfenhance(img, contrast_level)
File "D:\Program Files Green\ChangePDFContrast\pdf_enhance.py", line 18, in pdfenhance
LUT[range_min:range_max+1]=np.linspace(start=0,stop=255,num=(range_max-range_min)+1,endpoint=True,dtype=np.uint8)
ValueError: could not broadcast input array from shape (123,) into shape (0,)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\shutil.py", line 618, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\tempfile.py", line 843, in onerror
_os.unlink(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Program Files Green\ChangePDFContrast\main.py", line 49, in
with tempfile.TemporaryDirectory() as path:
File "C:\Program Files\Python310\lib\tempfile.py", line 869, in exit
self.cleanup()
File "C:\Program Files\Python310\lib\tempfile.py", line 873, in cleanup
self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 620, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Program Files\Python310\lib\tempfile.py", line 846, in onerror
cls._rmtree(path, ignore_errors=ignore_errors)
File "C:\Program Files\Python310\lib\tempfile.py", line 855, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 750, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files\Python310\lib\shutil.py", line 601, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\Program Files\Python310\lib\shutil.py", line 598, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\Users\Kira\AppData\Local\Temp\tmpmks64yy2\d64eb5e2-ed0a-4bc3-8d1d-1e158bcce485-2.ppm'