Friday 11 July 2014

RuntimeError: Unable to import decimal

After converting a python file to .exe with cx_Freeze, and attempt to run it, i get the following error even though i imported decimal as the error and various tutorials suggested.

Here is how i resolved it.


1. First, if your cx_Freeze version is higher that 4.3, uninstall it and install version 4.3.1. For PyQt, use ver 4 not 5. PyQt5 was more pain than glory for me.Use PyQt4-4.10.4-gpl-Py3.3-Qt5.2.0-x32-2.exe preferably. I noticed that later versions kept popping up the page even though i imported decimal.

2. After installing the above, copy <python_dir>\lib\site-packaging\PyQt4\plugins\platforms\qwindows.dll to <app_dir>\platforms\qwindows.dll. Also copy <python_dir>\lib\site-packaging\PyQt4\LibEGL.dll to <app_dir>.

Error when qwindows.dll isn't loaded

NOTE: These 2 files are important, else your program won't run. if the files aren't copied you won't be able to run the files on systems that don't have PyQt4 installed.

After you're done. you can then your APP. Congrats!!!!!

No comments:

Post a Comment