我在 Windows 11 上使用 python 3,我正在编写一个代码,它只是将 excel 复制为图像并将其粘贴到 word 文档中。我正在使用 excel2img 包来做这件事,但代码不工作,我得到了休闲错误:
Traceback (most recent call last):
File "C:\Users\Matheus Seidel\OneDrive\NCEE Meus documentos\Arquivos padrão\Ponte\Pontes - Dimensionamento de viga.py", line 40, in <module>
excel2img.export_img("Vão 1 - Viga interna.xlsx", "esforços.png", "", "'Esforços solicitantes'!A1:K48")
File "C:\Users\Matheus Seidel\AppData\Local\Programs\Python\Python311\Lib\site-packages\excel2img\excel2img.py", line 121, in export_img
im = ImageGrab.grabclipboard()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Matheus Seidel\AppData\Local\Programs\Python\Python311\Lib\site-packages\PIL\ImageGrab.py", line 112, in grabclipboard
fmt, data = Image.core.grabclipboard_win32()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: failed to open clipboard
同样的代码在另一台windows电脑上运行,所以一定是我系统的问题,而不是代码中的问题。
有谁知道如何解决这个问题?
谢谢。
我试过重新安装excel2img,但是没有用。