Ailln/cn2an

编译执行出错

YYGe01 opened this issue · 1 comments

你好,我用pyinstaller 打包py文件,然后exe执行,会出错,出错信息如下。
(docparser) PS C:\Users\49476\glory\work\code_test\dist\main> .\main.exe
Traceback (most recent call last):
File "main.py", line 2, in
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "cn2an_init
.py", line 7, in
File "cn2an\cn2an.py", line 9, in init
File "cn2an\utils.py", line 10, in get_default_conf
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\49476\glory\work\code_test\dist\main\cn2an/config.yaml'
[27324] Failed to execute script 'main' due to unhandled exception!

重现如下:
新建一个mian.py文件,内容如下:
import cn2an
def print_hi(name):
print(f'Hi, {name}')
if name == 'main':
print_hi('PyCharm')

然后执行 pyinstaller main.py。
会生成dist/main文件夹,然后执行main.exe,出错

我是在window10平台做的测试,不清楚什么原因,目前是认为打包后,cn2an代码目录结构破坏了,找不到文件,
不知道能否提供改进建议,谢谢!

Ailln commented

v0.5.19 已修复,请升级后再次尝试。