使用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的更多相关文章

  1. OSError: cannot open resource(pillow错误处理)

    https://www.jianshu.com/p/c64ae3e9b196 pillow使用备忘之OSError: cannot open resource错误处理 在使用pillow过程中,Pyt ...

  2. captcha库报错"OSError: cannot open resource"

    问题描述 在win平台上python虚拟环境下使用captcha库生成验证码报错OSError: cannot open resource 代码 from captcha.image import I ...

  3. python-----贴图 和 报错:OSError: image file is truncated (8 bytes not processed)的处理

    将一张图片贴到另一张图片上,代码如下: from PIL import Image import os from PIL import ImageFile ImageFile.LOAD_TRUNCAT ...

  4. 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 ...

  5. 在python中使用print()时,raw write()返回无效的长度:OSError: raw write() returned invalid length 254 (should have been between 0 and 127)

    写出一个不是code的bug,很烦恼,解决了挺长时间,都翻到外文来看,不过还是解决了,只尝试了一种简单可观的方法,希望对大家有用 我正在使用Django与Keras(tensorflow)来训练一个模 ...

  6. ionic报错: Failed to load resource

    隔了一天,才发现是代码写错了 出错的原因是在ts 文件中使用这样的定义 data: [] = ['高新区', '经开区', '其他园区']; 错误在于这个定义的类型,不能是 [],修改成 any就没有 ...

  7. 黄聪:AngularJS中的$resource使用与Restful资源交互(转)

    原文:http://blog.csdn.net/he90227/article/details/50525836 1.AngularJS中的 $resource 这个服务可以创建一个资源对象,我们可以 ...

  8. 【c3p0】报错:java.io.FileNotFoundException: Resource not found at path '/mchange-log.properties'

    配置项目启动初始,报错如下: java.io.FileNotFoundException: Resource not found at path '/mchange-commons.propertie ...

  9. 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 ...

随机推荐

  1. [数据结构]伸展树(Splay)

    #0.0 写在前面 Splay(伸展树)是较为重要的一种平衡树,理解起来也依旧很容易,但是细节是真的多QnQ,学一次忘一次,还是得用博客加深一下理解( #1.0 Splay! #1.1 基本构架 Sp ...

  2. python 小兵(2)

    while 条件: 结构体 if=条件: 等于 while 条件: 结构体 else: print(int(Ture))    1 print(int(False))   0 切片顾头不顾尾 prin ...

  3. 使用estimatedRowHeight的优缺点

    使用estimatedRowHeight的优缺点 1.优点 1> 可以降低tableView:heightForRowAtIndexPath:方法的调用频率 2> 将[计算cell高度的操 ...

  4. bom-location

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. iOS 学习资料Blog 技术论坛等,不断添加中。。。。

    iOS 学习资料整理 http://www.jianshu.com/p/dc81698a873c    中文 iOS/Mac 开发博客列表  https://github.com/tangqiaobo ...

  6. Mac版play框架配置

    打开终端 输入 cd  - 再输入  touch .bash_profile 然后打开 open .bash_profile .bash_profile就是mac的配置文件  export PATH= ...

  7. Kubernetes(K8s)基础概念 —— 凿壁偷光

    Kubernetes(K8s)基础概念  --  凿壁偷光 K8s是什么:全称 kubernetes  (k12345678s) 作用:用于自动部署,扩展和管理"容器化应用程序"的 ...

  8. 部署YUM仓库 (最近睡眠质量很差,你什么时候搬过来住)

    部署YUM仓库 1.YUM概述 YUM(Yellow dog Updater Modified) 基于RPM包构建的软件更新机制 可以自动解决依赖关系 所有软件由集中的YUM软件仓库提供 2.主备安装 ...

  9. MySQL高级篇笔记

    目录 MySQL体系结构 存储引擎特点 InnoDB底层文件 MyISAM底层文件 索引 慢查询日志 profile详情 explain执行计划 EXPLAIN 执行计划各字段含义: 索引使用 最左前 ...

  10. linux_19

    haproxy https实现 总结tomcat的核心组件以及根目录结构 tomcat实现多虚拟主机 nginx实现后端tomcat的负载均衡调度 简述memcached的工作原理