-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"FileNotFoundError: [Errno 2]" when creating exe with langdetect #285
Comments
The problem appears to be that applangdetect is trying to find some file called messages.properties. Correct? Since this is not a Python file and not brought in by an import in the source code, there is no way for PyInstaller to know it should be included. That is why pyinstaller/pyinstaller#1842 referred the user to the part of the manual that tells how to include data files. The manual is no longer at that URL, it is here: http://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-files-to-the-bundle You need to figure out what non-Python files applangdetect will need at run-time and modify the .spec file to tell PyInstaller to include them. If you need help in that, you can use the PyInstaller mailing list at https://groups.google.com/forum/#!forum/pyinstaller . A PyInstaller "hook" is a file that builds this information into the PyInstaller distribution so others who use applangdetect will not need to modify the spec file. Perhaps when you work this out you can contribute a hook file for it. |
This worked for me: a = Analysis(
# your other stuff here...
datas=[
('langdetect/utils', 'langdetect/utils'), # for messages.properties file
('langdetect/profiles', 'langdetect/profiles'), # don't forget if you load langdetect as a submodule of your app, change the second string to the relative path from your parent module. The first argument is the relative path inside the pyinstaller bundle.
]
# the rest of your analysis spec...
) |
You may want to provide a hook for this. |
I had the same issue. However I used some hooks for this as it was easier in my opinion Solution guide
Now the issue is fixed and you can run your app. |
Did you fix it ? I have the same problem and when I followed the previous answer I didn't got the required hooks:
|
If your PyInstaller version is reasonably recent, you should now be able to use:
|
Thank you so much that's solved my problem |
pyinstaller applangdetect.py
applangdetect.exe
[Windows 7, 32 bits, Python 3.4, PyInstaller==3.3.dev0+abfc80661, langdetect==1.0.7]
Simplest of all "print(langdetec.detect("test")) cannot be packed by pyintaller.
What should I do to fix this? Any hints will be appreciated.
(Also reported in pyinstaller/pyinstaller#1842, seems not fixed)
The text was updated successfully, but these errors were encountered: