Error converting .py to executable using cx_freeze
Question: I am using python 3.3.3

the following is my setup.py code

    
    
        import sys
    from cx_Freeze import setup, Executable
    
    
    build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
    
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"
    
    setup(  name = "send_email",
            version = "0.1",
            description = "send the email",
            options = {"build_exe": build_exe_options},
            executables = [Executable("send_email.py", icon="icon.ico", base=base)])  
    

The only import in my send_email.py file is smtplib.

The following error message is what I receive when building the executable in
the command window:

    
    
    c:\Python33>python.exe setup.py build
    running build
    running build_exe
    copying c:\Python33\lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> build\exe.
    win-amd64-3.3\send_email.exe
    copying C:\Windows\SYSTEM32\python33.dll -> build\exe.win-amd64-3.3\python33.dll
    
    Traceback (most recent call last):
      File "setup.py", line 17, in <module>
        executables = [Executable("send_email.py", icon="icon.ico", base=base)])
      File "c:\Python33\lib\site-packages\cx_Freeze\dist.py", line 365, in setup
        distutils.core.setup(**attrs)
      File "c:\Python33\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\Python33\lib\distutils\dist.py", line 917, in run_commands
        self.run_command(cmd)
      File "c:\Python33\lib\distutils\dist.py", line 936, in run_command
        cmd_obj.run()
      File "c:\Python33\lib\distutils\command\build.py", line 126, in run
        self.run_command(cmd_name)
      File "c:\Python33\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\Python33\lib\distutils\dist.py", line 936, in run_command
        cmd_obj.run()
      File "c:\Python33\lib\site-packages\cx_Freeze\dist.py", line 235, in run
        freezer.Freeze()
      File "c:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 577, in Freeze
    
        self._FreezeExecutable(executable)
      File "c:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 169, in _Freez
    eExecutable
        cx_Freeze.util.AddIcon(exe.targetName, exe.icon)
    SystemError: error return without exception set
    


Answer: I had the same message error and I fixed it by giving the full path of the
icon file. By the way, make sure the icon is in .ico format (At first I
renamed the extensions of a .png file to .ico and caused the process to crash,
lastly I converted the .png file to the .ico format and it worked).

