OSError: [Errno 22] Invalid Argument: '\u202aC:/Users/.../Documents/Python/fish.jpg' 操作系统错误:[错误编号22]参数无效:'\u202aC:/Users/.../Documents/Python/fish.jpg'

3
File = "C:\Python\lib\site-packages\PIL\Image.py", line 2580, in open
    fp = builtins.open(filename, "rb")

这段代码在我的电脑上可以正常工作,但在我的学生的电脑上会出现标题错误。他使用的是Windows 10系统,安装了最新的Python 3.7,通过命令提示符使用pip安装了Pillow,并通过Atom插件“script”安装了Atom编辑器。请问是否有人遇到过这种情况?(下面的代码是一个简单的图像混合示例。)(...代表用户名文件夹,在每台计算机上都不同。)
from PIL import Image

def main():

    size = width, height = 1080, 720

    imageOne = Image.open("C:/Users/.../Documents/Python/fish.jpg")
    imageTwo = Image.open("C:/Users/.../Documents/Python/tropicalfish.jpg")

    imageOne.thumbnail(size)
    imageTwo.thumbnail(size)

    imageOne.convert("RGB")
    imageTwo.convert("RGB")

    imageBlend = Image.blend(imageOne, imageTwo, .5)

    imageBlend.show()

    del imageOne, imageTwo, imageBlend

if (__name__ == "__main__"):

    main()
1个回答

0

如果您使用正斜杠作为目录分隔符,则无需使用原始字面量。 - Ignacio Vazquez-Abrams

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接