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格式的.几百页的文档,如果手工一个个去处理,几乎是不可能的事情.这时就要找一个库写脚本去实现 ...
随机推荐
- PIX防火墙配置A/S故障切换
PIX防火墙配置A/S故障切换 1.基本命令 failover show failover failover lan enable failover lan interface zwish e2 fa ...
- Rocket - util - LanePositionedQueue
https://mp.weixin.qq.com/s/yO_9Ec3S5-AosRVLpsBgOg 简单介绍基于通道位置的队列(LanePositionedQueue)的实现. 1. ...
- undefined attribute name (XXXX)
Window --> Preferences --> Web --> HTML Files --> Editor --> Validation --> Attrib ...
- Java 解析 XML文件
个人博客网:https://wushaopei.github.io/ (你想要这里多有) package com.example.poiutis.xml; import com.example ...
- Java实现 蓝桥杯VIP 基础练习 高精度加法
java算法 蓝桥杯 高精度加法 问题描述 在C/C++语言中,整型所能表示的范围一般为-231到231(大约21亿),即使long long型,一般也只能表示到-263到263.要想计算更加规模的数 ...
- Java实现 LeetCode 335 路径交叉
335. 路径交叉 给定一个含有 n 个正数的数组 x.从点 (0,0) 开始,先向北移动 x[0] 米,然后向西移动 x[1] 米,向南移动 x[2] 米,向东移动 x[3] 米,持续移动.也就是说 ...
- Java实现 蓝桥杯VIP 算法提高 格子位置
算法提高 格子位置 时间限制:1.0s 内存限制:512.0MB 问题描述 输入三个自然数N,i,j (1<=i<=N,1<=j<=N),输出在一个N*N格的棋盘中,与格子(i ...
- Java实现 洛谷 P1582 倒水
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import ...
- python自学Day05(自学书籍python编程从入门到实践)
第6章 字典 6.1 一个简单的字典 先跟随书本创建一个简单的字典感受一下. alien_0 = {'color':'green','points':5} print(alien_0['color'] ...
- Hive的压缩存储和简单优化
一.Hive的压缩和存储 1,MapReduce支持的压缩编码 压缩格式 工具 算法 文件扩展名 是否可切分 对应的编码/解码器 DEFLATE 无 DEFLATE .deflate 否 org.ap ...