docx.opc.exceptions.PackageNotFoundError: Package not found at '文件名.docx' 问题解决
编译源程序时,提示:docx.opc.exceptions.PackageNotFoundError: Package not found at '文件名.docx' 。
源文件明明存在啊,难道是用的相对路径不能读取,于是换了绝对路径,结果还是提示此错误。
tpl = DocxTemplate("123.docx")
到底是什么原因呢?
百度了一下,找到如下提示:【原文:https://www.javaear.com/question/47199300.html】
This error simply means there is no .docx file at the location you specified.
Since you specified a relative path, the actual path used is determined by adding 'TestDir/dir2/doc22.docx' to the current working directory Python is using at run time.
You can discover the path being used with this short code snippet:
import os
print(os.path.abspath('TestDir/dir2/doc22.docx')
I expect you'll find that it prints out a path that does not exist, and that you'll need to modify the path string you give it to point to the right place.
Worst case, you can specify an absolute path, like /home/ch_dmitriy/Documents/Projects/Tutorials/TestDir/dir2/doc22.docx.
根据提示,插入上述代码后再次运行,查看显示的路径,便知道问题出在哪里了
C:\Program Files\Notepad++\456.docx
原来程序编译运行的默认地址是notpad++的安装目录,所以导致找不到文件了。
于是,在CMD中重新进入源文件目录,编译并运行,结果顺利通过编译。
docx.opc.exceptions.PackageNotFoundError: Package not found at '文件名.docx' 问题解决的更多相关文章
- Atitit s2018.2 s2 doc list on home ntpc.docx \Atiitt uke制度体系 法律 法规 规章 条例 国王诏书.docx \Atiitt 手写文字识别 讯飞科大 语音云.docx \Atitit 代码托管与虚拟主机.docx \Atitit 企业文化 每日心灵 鸡汤 值班 发布.docx \Atitit 几大研发体系对比 Stage-Gat
Atitit s2018.2 s2 doc list on home ntpc.docx \Atiitt uke制度体系 法律 法规 规章 条例 国王诏书.docx \Atiitt 手写文字识别 ...
- Atitit s2018.6 s6 doc list on com pc.docx Atitit s2018.6 s6 doc list on com pc.docx Aitit algo fix 算法系列补充.docx Atiitt 兼容性提示的艺术 attilax总结.docx Atitit 应用程序容器化总结 v2 s66.docx Atitit file cms api
Atitit s2018.6 s6 doc list on com pc.docx Atitit s2018.6 s6 doc list on com pc.docx Aitit algo fi ...
- Package CJK Error: Invalid character code. 问题解决方法--xelatex和pdflatex编译的转换
Package CJK Error: Invalid character code. 问题解决方法--xelatex和pdflatex编译的转换 解决方法:添加格式说明信息 将下面语句: \docum ...
- 2019t1_sumdoc_list.txt aa.docx acc baidu v2 sbb.docx Acc jindon v2 sbb.docx assetsList.html Atiitt 日本刑法典读后笔记.docx Atiti 遇到说花心的时候赞美应对.docx Atitit lesson.docx Atitit malye主义、mzd思想和dsp理论的区别和联系.docx Ati
2019t1_sumdoc_list.txtaa.docxacc baidu v2 sbb.docxAcc jindon v2 sbb.docxassetsList.htmlAtiitt 日本刑法典读 ...
- E:Package 'Vim' has no installation candidate问题解决
问题描述: root@zhouls-virtual-machine:~# apt-get install vimReading package lists... DoneBuilding depend ...
- OpenOffice将MS docx转换成pdf文件偶数页眉不显示问题解决办法
OpenOffice版本:4.0(Windows.Linux下测试都出现问题) MS Office版本:2007 问题描述 使用OpenOffice将MS的docx文件转换为pdf文件时,docx文件 ...
- CentOS7 - Package does not match intended download 问题解决
yum 安装软件,有时会出现 Error: Package does not match intended download,这时需要彻底清除已有的下载,然后重新安装即可. $ sudo yum cl ...
- Python-docx 读取word.docx内容
第一次写博客,也不知道要写点儿什么好,所以就把我在学习Python的过程中遇到的问题记录下来,以便之后查看,本人小白,写的不好,如有错误,还请大家批评指正! 中文编码问题总是让人头疼,想要用Pytho ...
- $用python-docx模块读写word文档
工作中会遇到需要读取一个有几百页的word文档并从中整理出一些信息的需求,比如产品的API文档一般是word格式的.几百页的文档,如果手工一个个去处理,几乎是不可能的事情.这时就要找一个库写脚本去实现 ...
随机推荐
- Jupyternotebook添加c++核心支持的配置过程
一.环境:虚拟机:(1)系统:centos7.5_1804(64bit)版本(2)软件环境:git.python3.5.3.Jupyter4.4.0二.下载安装脚本:资源及安装说明:https://g ...
- 当微信小程序遇到云开发,再加上一个类似 ColorUI 的模板,人人都能做小程序了
作为一个 Java 程序员,早就想尝试一把微信小程序,但是一直苦于没有想法,再加上做一个漂亮的页面实在不太擅长. 由于自己比较喜欢历史,经常看历史方面的书.在一次梳理中国现有的朝代时,突然想到,要是可 ...
- jchdl - GSL Port
https://mp.weixin.qq.com/s/DVmMrCFgNLuZDtssQ85w7A org.jchdl.model.gsl.core.meta.Port.java gen ...
- (Java实现) 图的m着色问题
图的m着色问题 [问题描述] 给定无向连通图G和m种不同的颜色.用这些颜色为图G的各顶点着色,每个顶点着一种颜色.如果有一种着色法使G中每条边的2个顶点着不同颜色,则称这个图是m可着色的.图的m着色问 ...
- Java实现 蓝桥杯VIP 算法提高 淘淘的名单
算法提高 淘淘的名单 时间限制:100ms 内存限制:8.0MB 问题描述 by ZBY- ? 淘淘拿到了一份名单,他想对上面的名字进行处理,挑出一些特殊的名字,他请你来帮忙. 淘淘关注以下名字: 如 ...
- Java实现Catenyms(并查集+dfs+欧拉回路)
Description A catenym is a pair of words separated by a period such that the last letter of the firs ...
- Linux 文件特殊权限-Sticky BIT
SBIT粘着位作用 只对目录有效 普通用户对该目录拥有w和x权限,即普通用户可以在此目录有写权限 如果没有粘着位,普通拥有写权限,就可以删除目录下所有文件,包括其他用户创建的文件,一旦有粘着位,只有r ...
- github常用的协同开发流程
github的实用之处 对于刚刚工作的小白来说,顺利完成工作任务是首要考虑的事情,业余时间多了解了解其他的技术将有利于自己对该领域的熟悉,比如我们都拥有的github,除了在网站里查看优秀的代码,其还 ...
- vue甘特图gantt
vue做甘特图,先大致介绍下核心功能: (1)横轴.纵轴拖拽: (2)自定义监听点击事件(双击.右键等)(3)任务之间显示父子层级关系:(4)左侧列表信息,右侧时间轴表示任务:(5)每个任务可以订制样 ...
- rsyslog日志收集器
rsyslog详解(思维导图) 1. 日志收集概述 1.1 日志记录 时间 事件 1.2 日志收集器 syslog rsyslog elk stack 1.3 日志文件 文件记录的日志格式 其他日志文 ...