<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Trouble with py2exe and arcpy / arcgisscripting in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426903#M33494</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to build an exe using py2exe.&amp;nbsp; My script uses wxPython for a GUI, and arcpy for an Insert Cursor and an Update Cursor on one table inside of a personal gdb.&amp;nbsp; I'm using ArcGIS 10.0 and Python 2.6, and Aptana Studio 3 + pyDev as an IDE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script works great inside Aptana.&amp;nbsp; My setup.py script executes and creates an EXE file inside of the dist folder of my project directory.&amp;nbsp; When I try to run the EXE, it crashes on import of arcpy.&amp;nbsp; The log file shows the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Traceback (most recent call last): &amp;nbsp; File "redrover-hazus.py", line 66, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\__init__.pyo", line 17, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\geoprocessing\__init__.pyo", line 14, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\geoprocessing\_base.pyo", line 14, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 98, in load_module ImportError: MemoryLoadLibrary failed loading arcgisscripting.pyd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My setup.py script looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from distutils.core import setup import py2exe, sys, os&amp;nbsp; data_files = ["file1", "file2"]&amp;nbsp;&amp;nbsp; sys.argv.append('py2exe')&amp;nbsp; setup( &amp;nbsp;&amp;nbsp;&amp;nbsp; windows = [{'script': "script.py",'icon_resources':[(1,"icon.ico")]}], &amp;nbsp;&amp;nbsp;&amp;nbsp; zipfile = None, &amp;nbsp;&amp;nbsp;&amp;nbsp; data_files=data_files, &amp;nbsp;&amp;nbsp;&amp;nbsp; options = {'py2exe':&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'includes': "arcgisscripting", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'bundle_files': 1, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dist_dir': "dist", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'optimize': 2, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All of the users who will run this EXE will already have ArcGIS 10.0 and Python 2.6.&amp;nbsp; Is there a way I can specify this in my setup.py file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-- Josh Groeneveld&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Mar 2013 21:33:50 GMT</pubDate>
    <dc:creator>deleted-user-Me5W-uJw0Ojh</dc:creator>
    <dc:date>2013-03-21T21:33:50Z</dc:date>
    <item>
      <title>Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426903#M33494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to build an exe using py2exe.&amp;nbsp; My script uses wxPython for a GUI, and arcpy for an Insert Cursor and an Update Cursor on one table inside of a personal gdb.&amp;nbsp; I'm using ArcGIS 10.0 and Python 2.6, and Aptana Studio 3 + pyDev as an IDE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script works great inside Aptana.&amp;nbsp; My setup.py script executes and creates an EXE file inside of the dist folder of my project directory.&amp;nbsp; When I try to run the EXE, it crashes on import of arcpy.&amp;nbsp; The log file shows the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Traceback (most recent call last): &amp;nbsp; File "redrover-hazus.py", line 66, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\__init__.pyo", line 17, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\geoprocessing\__init__.pyo", line 14, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 82, in load_module &amp;nbsp; File "arcpy\geoprocessing\_base.pyo", line 14, in &amp;lt;module&amp;gt; &amp;nbsp; File "zipextimporter.pyo", line 98, in load_module ImportError: MemoryLoadLibrary failed loading arcgisscripting.pyd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My setup.py script looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from distutils.core import setup import py2exe, sys, os&amp;nbsp; data_files = ["file1", "file2"]&amp;nbsp;&amp;nbsp; sys.argv.append('py2exe')&amp;nbsp; setup( &amp;nbsp;&amp;nbsp;&amp;nbsp; windows = [{'script': "script.py",'icon_resources':[(1,"icon.ico")]}], &amp;nbsp;&amp;nbsp;&amp;nbsp; zipfile = None, &amp;nbsp;&amp;nbsp;&amp;nbsp; data_files=data_files, &amp;nbsp;&amp;nbsp;&amp;nbsp; options = {'py2exe':&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'includes': "arcgisscripting", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'bundle_files': 1, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dist_dir': "dist", &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'optimize': 2, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All of the users who will run this EXE will already have ArcGIS 10.0 and Python 2.6.&amp;nbsp; Is there a way I can specify this in my setup.py file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-- Josh Groeneveld&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 21:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426903#M33494</guid>
      <dc:creator>deleted-user-Me5W-uJw0Ojh</dc:creator>
      <dc:date>2013-03-21T21:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426904#M33495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm trying to build an exe using py2exe. &lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See this thread&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/message/505022"&gt;Re: ArcGIS 10.1 python script to exe is not working&lt;/A&gt;​&amp;nbsp; (updated link)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I suppose the main question is - why are you using py2exe? If someone has ArcGIS installed, they will have Python installed as well. If you are trying to hide your code you can b-code compile it (pyc).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 22:13:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426904#M33495</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-03-21T22:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426905#M33496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I byte-compile my code, will it give the user any other Python modules I have that they might not (such as wxPython)?&amp;nbsp; While I understand that anyone who has ArcGIS already has Python, there are other Python modules (aside from arcpy), that the users need for the script to work.&amp;nbsp; Also, my script ties into three other scripts that also need to be distributed along with the main script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My intention for creating an EXE is to bundle everything needed into one place.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2013 15:12:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426905#M33496</guid>
      <dc:creator>deleted-user-Me5W-uJw0Ojh</dc:creator>
      <dc:date>2013-03-22T15:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426906#M33497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You cannot compile a python script importing arcpy into an exe.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 12:24:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426906#M33497</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-03-25T12:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426907#M33498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You cannot compile a python script importing arcpy into an exe.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;How come?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is not possible, are there other options that would help me distribute the set of scripts and non-arcpy modules that the user needs to run it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:32:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426907#M33498</guid>
      <dc:creator>deleted-user-Me5W-uJw0Ojh</dc:creator>
      <dc:date>2013-03-25T20:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426908#M33499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If this is not possible, are there other options that would help me distribute the set of scripts and non-arcpy modules that the user needs to run it?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the python documentation on distutils:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/distutils/index.html"&gt;Distributing Python Modules&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2013 22:23:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426908#M33499</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2013-03-25T22:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426909#M33500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found a solution to do what I needed to do.&amp;nbsp; The set of scripts I wanted to bundle together only used the arcpy module for one search cursor and one insert cursor.&amp;nbsp; I re-wrote my scripts to use the pyodbc module rather than arcpy, since the file the scripts work with is an Microsoft Access file (.mdb).&amp;nbsp; Since my scripts no longer call arcpy, py2exe generated a perfectly functioning EXE.&amp;nbsp; Thanks Matt and Curt for your advice.&amp;nbsp; It was very helpful to me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 17:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426909#M33500</guid>
      <dc:creator>deleted-user-Me5W-uJw0Ojh</dc:creator>
      <dc:date>2013-03-29T17:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with py2exe and arcpy / arcgisscripting</title>
      <link>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426910#M33501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why we &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;cannot &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;compile a python script importing arcpy into an exe&lt;/SPAN&gt;, by the way, I tried to convert .py into .exe with &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;arcpy &lt;/SPAN&gt;,but there are some problems, so I want to know the reason&lt;/SPAN&gt;&lt;/P&gt;&lt;H1 style="margin-bottom: 0.5em; font-size: 22px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"&gt;&lt;A class="question-hyperlink" href="http://stackoverflow.com/questions/17036630/how-can-i-use-py2exe-with-arcpy" style="margin: 0 0 0.5em; font-size: 24px; color: #222222; font-weight: normal;"&gt;&lt;IMG alt="problem.bmp" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/88127_problem.bmp" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2015 14:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trouble-with-py2exe-and-arcpy-arcgisscripting/m-p/426910#M33501</guid>
      <dc:creator>yingjieliu</dc:creator>
      <dc:date>2015-04-22T14:26:21Z</dc:date>
    </item>
  </channel>
</rss>

