PIL-ImageFont:OSError: cannot open resource
使用PIL时,创建某个字体Font对象时出错:
font=ImageFont.truetype('Arial.ttf',36)
可能原因有两个:
1、PIL无法定位到字体文件的位置。
可以通过提供绝对路径解决,比如
font=ImageFont.truetype('C:\Windows\Fonts\Arial.ttf',36)
2、文件名写错了
font=ImageFont.truetype('arial.ttf',36)
一般情况下是第二种
PIL-ImageFont:OSError: cannot open resource的更多相关文章
- OSError: cannot open resource(pillow错误处理)
https://www.jianshu.com/p/c64ae3e9b196 pillow使用备忘之OSError: cannot open resource错误处理 在使用pillow过程中,Pyt ...
- captcha库报错"OSError: cannot open resource"
问题描述 在win平台上python虚拟环境下使用captcha库生成验证码报错OSError: cannot open resource 代码 from captcha.image import I ...
- python-----贴图 和 报错:OSError: image file is truncated (8 bytes not processed)的处理
将一张图片贴到另一张图片上,代码如下: from PIL import Image import os from PIL import ImageFile ImageFile.LOAD_TRUNCAT ...
- Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)
在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...
- 在python中使用print()时,raw write()返回无效的长度:OSError: raw write() returned invalid length 254 (should have been between 0 and 127)
写出一个不是code的bug,很烦恼,解决了挺长时间,都翻到外文来看,不过还是解决了,只尝试了一种简单可观的方法,希望对大家有用 我正在使用Django与Keras(tensorflow)来训练一个模 ...
- ionic报错: Failed to load resource
隔了一天,才发现是代码写错了 出错的原因是在ts 文件中使用这样的定义 data: [] = ['高新区', '经开区', '其他园区']; 错误在于这个定义的类型,不能是 [],修改成 any就没有 ...
- 黄聪:AngularJS中的$resource使用与Restful资源交互(转)
原文:http://blog.csdn.net/he90227/article/details/50525836 1.AngularJS中的 $resource 这个服务可以创建一个资源对象,我们可以 ...
- 【c3p0】报错:java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'
配置项目启动初始,报错如下: java.io.FileNotFoundException: Resource not found at path '/mchange-commons.propertie ...
- Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException
错误提示: defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean ...
随机推荐
- jenkins pipeline设置
转:https://mp.weixin.qq.com/s/MwyBsUWUQASGMr_erGfzZA
- Floyd 循环检测算法(快慢指针法/龟兔指针法)
Floyd Cycle Detection Algorithm Floyd Cycle Detection Algorithm,即 Floyd 循环检测算法,又称快慢指针法.龟兔指针法.该算法用于 ...
- Python3.7.3 + pycharm安装
Python3.7.3下载地址: https://www.python.org/ https://www.python.org/getit/ Pycharm: http://www.jetbrains ...
- C++ STL 容器概述
在STL编程中,容器是经常用到的一种数据结构,在C++标准库中,容器分为: 序列式容器 关联式容器 二者本质区别在于,序列式容器是通过元素在容器中的位置进行顺序存储和元素访问.关联容器则是通过键[ke ...
- vi TOhtml:复制保持格式和高亮
1. 文本编辑:在vim中编辑好,复制到opera mail中就会格式错乱,比如:行前空格.缩进消失:2. 代码复制到其他地方,无法显示彩色高亮:找到了一个变通方案:使用TOhtml把vim内容转换为 ...
- 设置程序启动时加载的storyboard
这个设置表明:程序启动时会加载Main.storyboard
- 使用ajax上传文件
1. XMLHttpRequest(原生ajax) [](javascript:void(0) <input class="file" type="file&quo ...
- logback1.3.x配置详解与实践
前提 当前(2022-02前后)日志框架logback的最新版本1.3.0已经更新到1.3.0-alpha14版本,此版本为非stable版本,相对于最新稳定版1.2.10来说,虽然slf4j-api ...
- MLlib学习——基本数据类型
数据类型--基于RDD的API 本地矢量 标记点 本地矩阵 分布式矩阵 RowMatrix(行矩阵) IndexedRowMatrix(索引行矩阵) CoordinateMatrix(坐标矩阵) Bl ...
- 关于一些基础的dp——硬币的那些事(dp的基本引入)
1.最少硬币问题大体题意: 有n种硬币,面值分别是v1,v2......vn,数量无限,输入一个非负整数s,选用硬币使其和为s,要求输出最少的硬币组合. 我们可以这样分析: 定义一个名为Min[s]的 ...