title: ImportError: cannot import name MAXREPEAT with cx_Freeze
body: <p>I'm running into an issue with <code>cx_Freeze</code> when running a frozen application (works fine unfrozen).</p>
  
  <p>When running the program it results in the following traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in &lt;module&gt;
      exec code in m.__dict__
    File "PythonApp/mainframe.py", line 3, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/dbus/__init__.py", line 103, in &lt;module&gt;
      from dbus._dbus import Bus, SystemBus, SessionBus, StarterBus
    File "/usr/local/lib/python2.7/site-packages/dbus/_dbus.py", line 39, in &lt;module&gt;
      from dbus.bus import BusConnection
    File "/usr/local/lib/python2.7/site-packages/dbus/bus.py", line 39, in &lt;module&gt;
      from dbus.connection import Connection
    File "/usr/local/lib/python2.7/site-packages/dbus/connection.py", line 27, in &lt;module&gt;
      import threading
    File "/usr/local/lib/python2.7/threading.py", line 44, in &lt;module&gt;
      module='threading', message='sys.exc_clear')
    File "/usr/local/lib/python2.7/warnings.py", line 57, in filterwarnings
      import re
    File "/usr/local/lib/python2.7/re.py", line 105, in &lt;module&gt;
      import sre_compile
    File "/usr/local/lib/python2.7/sre_compile.py", line 14, in &lt;module&gt;
      import sre_parse
    File "/usr/local/lib/python2.7/sre_parse.py", line 17, in &lt;module&gt;
      from sre_constants import *
    File "/usr/local/lib/python2.7/sre_constants.py", line 18, in &lt;module&gt;
      from _sre import MAXREPEAT
  ImportError: cannot import name MAXREPEAT
  </code></pre>
  
  <p>I'm on linux using a version of python 2.7.4 that I built from source, and importing <code>_sre</code> from a prompt works and I can access the <code>MAXREPEAT</code> constant.</p>
  
  <p>This is usually down to <code>cx_Freeze</code> not pulling everything into <code>library.zip</code> and can be fixed by explicitly naming the module in <code>cx_Freeze</code>s setup include list and is the <a href="https://stackoverflow.com/questions/2223128/cx-freeze-importerror-cannot-import-name">solution to this similar question</a>, but that hasn't helped here.</p>
  
  <p>This <code>_sre</code> module seems weird.. there's no <code>_sre</code> file in the <code>library.zip</code> generated but from that error it seems like it can find it, however it can't import that symbol? Surely if the module wasn't there it would be a "<code>No module named _sre</code>" error. Or possibly a circular import but <code>_sre</code> stub doesn't have any imports.</p>
  
  <p>What's odd is I can't seem to find the file either - is this module dynamically created when importing somehow?</p>
  
  <pre><code>find /usr/local/lib/python2.7 -name "_sre*"
  </code></pre>
  
  <p>doesn't return anything, and the imported <code>_sre</code> module doesn't have a <code>__file__</code> attribute either, so I've no idea how to make sure it's included as it shows up as a built-in.</p>
  
  <pre><code>&gt;&gt;&gt; import _sre
  &gt;&gt;&gt; _sre.__file__
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'module' object has no attribute '__file__'
  &gt;&gt;&gt; repr(_sre)
  "&lt;module '_sre' (built-in)&gt;"
  </code></pre>
  
  <p>This is <a href="https://stackoverflow.com/questions/15984650/python-wont-run-due-to-importerror-cannot-import-maxrepeat">similar to this question</a> also which was asked recently, but in this case he was getting the error in the regular interpreter, however for me it's just in <code>cx_Freeze</code>.</p>
  
  <h2>edit</h2>
  
  <p>Running <code>python -v</code> does seem like it's a built-in, so I'm not sure why <code>cx_Freeze</code> can miss it, or how I'd fix it.</p>
  
  <pre><code>...
  # /usr/local/lib/python2.7/re.pyc matches /usr/local/lib/python2.7/re.py
  import re # precompiled from /usr/local/lib/python2.7/re.pyc
  # /usr/local/lib/python2.7/sre_compile.pyc matches /usr/local/lib/python2.7/sre_compile.py
  import sre_compile # precompiled from /usr/local/lib/python2.7/sre_compile.pyc
  import _sre # builtin
  # /usr/local/lib/python2.7/sre_parse.pyc matches /usr/local/lib/python2.7/sre_parse.py
  import sre_parse # precompiled from /usr/local/lib/python2.7/sre_parse.pyc
  ...
  </code></pre>