프로그래밍/Python

auto-py-to-exe로 만든 파일에서 DistributionNotFound 에러가 발생할 때 해결법

앨런임더 2023. 10. 30. 04:46

문제 상황

파이썬으로 만든 프로그램을 exe 파일로 변환하기 위해 auto-py-to-exe를 사용했는데, 만들어진 파일을 실행해 보니 아래와 같은 오류가 발생하며 실행이 되지 않았다.

코드에 사용된 win10toast 모듈이 제대로 포함되지 않은 것 같다.

 

해결 방법은 생각보다 쉽게 발견할 수 있었다.

https://github.com/brentvollebregt/auto-py-to-exe/issues/207#issuecomment-957779150

 

Exe doesn't work · Issue #207 · brentvollebregt/auto-py-to-exe

I'm using Python 3.9.5. I wrote a script that will display a notification after starting the .exe, but when I tried to start it, it gives me this error: File "svatky.py", line 14, in <module> toast...

github.com

 

해결 방법

auto-py-exe 실행 시에 --copy-metadata=win10toast 인자를 추가해 주면 된다.

 

GUI 사용 시에는 Advanced > --copy-metadata 옆의 [+]를 누르고 win10toast를 입력하면 된다.