Search code examples
pythonpython-3.xcx-freeze

Python into MSI Exe using Cx_freeze, error message


Hello people of the world,

I have just finished a project, and would love to be able to turn it into an exe for distribution.

Problem is everytime i try to use cx_freeze to build it, when firing up the EXE i get this error message:-

Traceback(most recent call last):
File "C:\Python34\lib\site-packages\cx_Freeze\initscripts\Console.py",line 27, in <module>
    exec(code,m.__dict__)
File"calculator.py",line 1, in <module>
file"c:\Python\64bit\3.4\lib\importlib\_bootsrap.py",line2214,in_fine_and_load

Maybe the most relevant part of the error message:- `AttributeError:'module'object has no attribute 'fix_up_module'

My scripts for setup is this.

from cx_Freeze import setup, Executable


includefiles = ['prices.dat','raftlogomain.gif'] # include any files here that you wish
includes = []
excludes = []
packages = []

exe = Executable(
   script = "calculator.py",
   initScript = None,
   base = 'Win32GUI',
   targetName = "Glass Calculator.exe",
   copyDependentFiles = True,
   compress = True,
   appendScriptToExe = True,
   appendScriptToLibrary = True,
   icon = None 
)

setup(

    name = "Glass Calculator",
    version = "0.1",
    description = 'Bespoke Calculations',
    author = "Lewis Tabone",
    author_email = "lewis@raftfurniture.co.uk",
    options = {"build_exe": {"excludes":excludes,"packages":packages,
      "include_files":includefiles}},
    executables = [exe]
)

Which is pretty straight forward.

its infuriating because i cant do anything about it, someone must have the answer!

Many thanks in advance!


Solution

  • Reposting as an answer: this is a known bug caused by cx_Freeze being built with a different bugfix release of Python 3.4 than you're using.

    Reinstall cx_Freeze from this site. That's recompiled with the new version of Python, fixing the error.