6

Hey am relatively new to compiling python scripts to exe. Im using cx_freeze to compile my scripts and once its built i run the exe and it gives me this error. Have google around alot but not too sure. Error is:

Cannot import traceback module.
Exception: No module named re
Original Exception: No module named re

Not too sure how to go about fixing this. I read that possibly there is a clash between a module named re? in python? and a module named re in cx_freeze module?

My setup file looks like:

from cx_Freeze import setup, Executable

includes = []
includefiles = ['remindersText.pkl']
eggsacutibull = Executable(
    script = "podlancer.py",
    initScript = None,
    base = 'Win32GUI',
    targetName = "podlancer.exe",
    compress = True,
    copyDependentFiles = True,
    appendScriptToExe = False,
    appendScriptToLibrary = False,
    icon = None
    )

setup(
        name = "Podlancer",
        version = "0.1",
        author = 'jono',
        description = "Podlancer UI script",
        options = {"build_exe": {"includes":includes, "include_files": includefiles}},
        executables = [eggsacutibull]
        )
mechanical_meat
  • 163,903
  • 24
  • 228
  • 223
Mafster
  • 107
  • 1
  • 3
  • 12
  • This is a bug in cx_Freeze - it should be fixed in the next release, which hopefully is coming in the next week or so. – Thomas K Sep 16 '13 at 21:44

3 Answers3

6

Try to change

includes = []

to

includes = ["re"]

That worked for me

Azimkhan
  • 330
  • 3
  • 7
  • 1
    legend. =) Thanks bro! would like to know what actually happened lol. I take it when compiling it needed to include that re module for watever reason...hence putting it in includes (makes sense,kinda gutted i didnt think of that!)...anyone know what the re module is for? – Mafster May 28 '11 at 11:38
2

cx_freeze will barf if the runtime working directory is not the directory that the executable is in.

Is re the first import you do? What happens when you do them in a different order?

Nick ODell
  • 15,465
  • 3
  • 32
  • 66
0

Meeting this same problem putting re in includes didn't work for me. It produced a cx_Freeze.freezer.ConfigError when rebuilding the .py file.

import sys
from cx_Freeze import setup, Executable

build_exe_options = {'include_files': ['re']}

setup(  name = "Foreground Window Montior",
        version = "0.1",
        description = "Query the foreground window.",
        options = {'build_exe': build_exe_options},
        executables = [Executable("actWin_Query.py")])

If I put re in packages rather than in include_files it did not produce this compile error.

import sys
from cx_Freeze import setup, Executable

build_exe_options = {"packages": ["re"]}

setup(  name = "Foreground Window Montior",
        version = "0.1",
        description = "Query the foreground window.",
        options = {'build_exe': build_exe_options},
        executables = [Executable("actWin_Query.py")])
Phoenix
  • 4,386
  • 10
  • 40
  • 55