AssertionError when using py2exe
<p>I am fairly new to Python and I need some help with an error message I am receiving. I am trying to make an exe file from a tkinter script with the help of py2exe, but I keep getting an AssertionError whenever I try to run the setup.py script. I have already created an exe file on my computer only a couple of days ago out of the same script without using tkinter. Creating this exe file was no problem. I am wondering if the error message occurs due to the fact that I have already created an exe file recently.</p>

<p>My setup.py script looks normal:</p>

<pre><code>`# setup.py


from distutils.core import setup
import py2exe
setup(console=['MyScript.py'])`
</code></pre>

<p>Whenever I run it, I get this error:</p>

<p><code>AssertionError: distutils has already been patched by &lt;class 'py2exe.patch_distutils.patch_distutils.&lt;locals&gt;.Distribution'&gt;</code></p>

<p>The entire traceback looks like this:</p>

<pre><code>Traceback (most recent call last):
File "C:\Dir\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pycharm\pycharm_setup_runner.py", line 26, in &lt;module&gt;
exec (fh.read(), globals(), locals())
File "&lt;string&gt;", line 6, in &lt;module&gt;
File "C:\Dir\Python3\lib\distutils\core.py", line 134, in setup
ok = dist.parse_command_line()
File "C:\Dir\Python3\lib\distutils\dist.py", line 471, in parse_command_line
args = self._parse_command_opts(parser, args)
File "C:\Dir\Python3\lib\distutils\dist.py", line 527, in _parse_command_opts
cmd_class = self.get_command_class(command)
File "C:\Dir\Python3\lib\distutils\dist.py", line 817, in get_command_class
__import__ (module_name)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.2.3\helpers\pycharm\pycharm_commands\pycharm_test.py", line 4, in &lt;module&gt;
from setuptools.command import test
File "C:\Dir\Python3\lib\site-packages\setuptools\__init__.py", line 14, in &lt;module&gt;
from setuptools.extension import Extension
File "C:\Dir\Python3\lib\site-packages\setuptools\extension.py", line 10, in &lt;module&gt;
from .dist import _get_unpatched
File "C:\Dir\Python3\lib\site-packages\setuptools\dist.py", line 39, in &lt;module&gt;
_Distribution = _get_unpatched(_Distribution)
File "C:\Dir\Python3\lib\site-packages\setuptools\dist.py", line 35, in _get_unpatched
"distutils has already been patched by %r" % cls
AssertionError: distutils has already been patched by &lt;class'py2exe.patch_distutils.patch_distutils.&lt;locals&gt;.Distribution'&gt;
</code></pre>

<p>Does anyone know a workaround to this problem? I am working in Python3.4.1.</p>

<p>Thank you so much for helping!</p>