Closed CribberSix closed 2 years ago
So, this seems to be that the localzone
library can't find the files provided by the tzdata
library.
I do not currently know enough about how pyinstaller works to know why this is and how to fix it.
I think this probably is a question for Pyinstaller people, how to include the tzdata library so its data files are included.
When trying to package tzlocal into an executable with PyInstaller, there occurs a weird error. I first stumbled across it when trying to create an executable from another package that depends on tzlocal, but the error is limited to tzlocal (I tried packaging the 4 lines of code below and got the same error).
The following code works fine when I execute it in PyCharm / via Console, but once packaged, it looks for a file that doesn't exist on my windows and crashes while trying to handle the error.
Code
Packaging
Error
I looked up the path, but while the directory
_MEI110002
exists, there is no directory calledtzdata
within it. I'm guessing that the package then tried to handle the error in other ways, but failed twice more.Spec file
The spec from which I built the executable - I had to manually add tzdata as PyInstaller didn't see the second level import: