大佬教程收集整理的这篇文章主要介绍了如何解决 [WinError 2] 使用 PackerPy 时系统找不到指定的文件 -Python,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用 Packerpy 来验证打包脚本,为此我做了这个
template = 'license-manager.Json'
t = open(template,'r')
print(t.__sizeof__());
with open(template,'r') as f:
response = PackerExecutable().valIDate(f.read())
它给了我这个错误
192
TraceBACk (most recent call last):
file "C:/Users/dmeena/Desktop/pythonProject1/venv/aws/python/Tests/Tes1.py",line 10,in <module>
response = PackerExecutable().valIDate(f.read())
file "C:\Users\dmeena\\Desktop\pythonProject1\venv\lib\site-packages\packerpy\packer.py",line 81,in valIDate
return self.execute_cmd("valIDate",template,**kwargs)
file "C:\Users\dmeena\Desktop\pythonProject1\venv\lib\site-packages\packerpy\packer.py",line 125,in execute_cmd
p = subprocess.Popen(cmd_args,stdin=subprocess.PIPE if is_Json else None,file "C:\Users\dmeena\ApPDAta\Local\Programs\Python\python38\lib\subprocess.py",line 858,in __init__
self._execute_child(args,executable,preexec_fn,close_fds,line 1311,in _execute_child
hp,ht,pID,tID = _winAPI.CreateProcess(executable,args,fileNotFoundError: [WinError 2] The system cAnnot find the file specifIEd
Json 文件与此 python 脚本位于同一文件夹中,我能够读取并找到文件的大小,但是当我尝试将其作为参数传递给验证函数时,它给了我那个错误 让我知道我哪里出错了。
您没有正确阅读回溯。它不是在抱怨 JSON 文件。据说“packer”命令不存在。您必须在路径中包含 packer.exe
,或者与您的脚本位于同一目录中,或者将其路径传递给 PackerExecutable
函数。
以上是大佬教程为你收集整理的如何解决 [WinError 2] 使用 PackerPy 时系统找不到指定的文件 -Python全部内容,希望文章能够帮你解决如何解决 [WinError 2] 使用 PackerPy 时系统找不到指定的文件 -Python所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。