Skip to content
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

Build fails while trying to make an exe-file with cx_Freeze #25

Closed
bulkware opened this issue Feb 7, 2013 · 2 comments
Closed

Build fails while trying to make an exe-file with cx_Freeze #25

bulkware opened this issue Feb 7, 2013 · 2 comments

Comments

@bulkware
Copy link

bulkware commented Feb 7, 2013

I've been trying to include pyenchant with my program, and I can't get it to work with cx_freeze. If I build an exe with pyenchant, the program won't start. The error is:


cx_Freeze: Python error in main script

Traceback (most recent call last):
File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console3.py", line 27, in
exec(code, m.dict)
File "C:\Scripts\Spellcheck\spellcheck.py", line 14, in
from spellcheck import spellcheck # A class for spellchecking
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1558, in _find_and_load
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1525, in _find_and_load_unlocked
File "C:\Scripts\Spellcheck\spellcheck.py", line 5, in
import enchant # Python bindings for the Enchant spellchecking system
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1558, in find_and_load
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1525, in find_and_load_unlocked
File "C:\Python33\lib\site-packages\enchant__init
.py", line 90, in
from enchant import _enchant as _e
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1607, in _handle_fromlist
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 313, in _call_with_frames_removed
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1558, in _find_and_load
File "C:\Python\32-bit\3.3\lib\importlib_bootstrap.py", line 1525, in _find_and_load_unlocked
File "C:\Python33\lib\site-packages\enchant_enchant.py", line 80, in
e_path = utils.get_resource_filename("libenchant.dll")
File "C:\Python33\lib\site-packages\enchant\utils.py", line 244, in get_resource_filename
exe_path = unicode(sys.executable,sys.getfilesystemencoding())
TypeError: decoding str is not supported

@otsaloma
Copy link

I can confirm this (although for me it doesn't fail at build, but causes the DLL to not be found when trying to run the built exe).

unicode is in utils.py set to str so that call becomes

str(sys.executable, sys.getfilesystemencoding())

As sys.executable is an str object, it just doesn't work. For use with solely Python 3, I think you can just monkey-patch that line to read

exe_path = sys.executable

I don't have a proper fix to suggest as I don't understand all that complicated stuff done to support both Python 2 and 3.

@rfk
Copy link
Member

rfk commented Jan 27, 2014

should be fixed in 3032268, thanks for digging into this and sorry for the delay

@rfk rfk closed this as completed Jan 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants