首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >'\u202aC:/Users/.../Documents/Python/fish.jpg‘:[Errno 22]无效参数:OSError

'\u202aC:/Users/.../Documents/Python/fish.jpg‘:[Errno 22]无效参数:OSError
EN

Stack Overflow用户
提问于 2018-08-03 07:49:55
回答 1查看 7.4K关注 0票数 3
File = "C:\Python\lib\site-packages\PIL\Image.py", line 2580, in open
    fp = builtins.open(filename, "rb")

这段代码在我家运行良好,但在我学生的计算机上出现标题错误而失败。Windows10.Python3.7的新安装,使用命令提示符通过pip新安装Pillow,使用插件"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()
EN

回答 1

Stack Overflow用户

发布于 2018-08-03 08:55:39

您的路径中包含\u202a字符。试着去掉一些首字母,然后手动重写。并尝试使用类似于此r'C:/Users/的语法。

关于u202a - https://www.fileformat.info/info/unicode/char/202a/index.htm

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51663567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档