<?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 Re: Exposing Arcpy Python Script to Web in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32645#M2583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's &lt;/SPAN&gt;&lt;A href="http://docs.python.org/release/2.6.7/library/wsgiref.html"&gt;WSGI&lt;/A&gt;&lt;SPAN&gt;, which is an open standard that allows you to develop in &lt;/SPAN&gt;&lt;A href="https://www.djangoproject.com/"&gt;Django&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://docs.pylonsproject.org/"&gt;Pyramid&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://webpy.org/"&gt;web.py&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://flask.pocoo.org/"&gt;flask&lt;/A&gt;&lt;SPAN&gt;, or any of a number of other options. Flask or web.py are probably your best bet for porting from CGI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you run a web application that handles multiple requests in the same process (that is, running a Python WSGI server behind your IIS instance) then you don't incur the overhead of importing arcpy over and over.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Jul 2011 19:28:29 GMT</pubDate>
    <dc:creator>JasonScheirer</dc:creator>
    <dc:date>2011-07-15T19:28:29Z</dc:date>
    <item>
      <title>Exposing Arcpy Python Script to Web</title>
      <link>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32644#M2582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've got some Python code that takes an address as an input, calls the Bing geocoding service, then does some geoprocessing on the location, then outputs the geoprocessing results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I set up IIS so that the code runs as a CGI, and this works fine, except it doesn't work well under the load of multiple concurrent users.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Problems:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. For every request, a new arcpy is imported, etc., and each one of the resulting processes uses ~80MB of RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Even one process pegs the CPU at 100% for a while, so running more than one really bogs things down.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A. How can I get this thing to perform better, with respect to concurrent requests?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;B. Should I be looking at something other than CGI?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jamie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 16:54:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32644#M2582</guid>
      <dc:creator>JamieJackson</dc:creator>
      <dc:date>2011-07-15T16:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Exposing Arcpy Python Script to Web</title>
      <link>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32645#M2583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's &lt;/SPAN&gt;&lt;A href="http://docs.python.org/release/2.6.7/library/wsgiref.html"&gt;WSGI&lt;/A&gt;&lt;SPAN&gt;, which is an open standard that allows you to develop in &lt;/SPAN&gt;&lt;A href="https://www.djangoproject.com/"&gt;Django&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://docs.pylonsproject.org/"&gt;Pyramid&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://webpy.org/"&gt;web.py&lt;/A&gt;&lt;SPAN&gt;, or &lt;/SPAN&gt;&lt;A href="http://flask.pocoo.org/"&gt;flask&lt;/A&gt;&lt;SPAN&gt;, or any of a number of other options. Flask or web.py are probably your best bet for porting from CGI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you run a web application that handles multiple requests in the same process (that is, running a Python WSGI server behind your IIS instance) then you don't incur the overhead of importing arcpy over and over.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 19:28:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32645#M2583</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-07-15T19:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exposing Arcpy Python Script to Web</title>
      <link>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32646#M2584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;There's &lt;A href="http://docs.python.org/release/2.6.7/library/wsgiref.html"&gt;WSGI&lt;/A&gt;, which is an open standard that allows you to develop in &lt;A href="https://www.djangoproject.com/"&gt;Django&lt;/A&gt;, or &lt;A href="http://docs.pylonsproject.org/"&gt;Pyramid&lt;/A&gt;, or &lt;A href="http://webpy.org/"&gt;web.py&lt;/A&gt;, or &lt;A href="http://flask.pocoo.org/"&gt;flask&lt;/A&gt;, or any of a number of other options. Flask or web.py are probably your best bet for porting from CGI.&lt;BR /&gt;&lt;BR /&gt;If you run a web application that handles multiple requests in the same process (that is, running a Python WSGI server behind your IIS instance) then you don't incur the overhead of importing arcpy over and over.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for the tip. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I chose Flask. I made my way through its integration, but I ran into some hurdles, and now a brick wall:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I run my script stand-alone from the command line, everything goes okay, and I get the output I would expect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if I start up the werzeug server, and run the same script in the Flask context, it gets to a line that calls RefreshCatalog on a CSV file, and then dies silently. If I try/catch around that line, and print the error, I get a useless 99999 error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;Error: ERROR 999999: Error executing function.&lt;/PRE&gt;&lt;SPAN&gt;[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FWIW, yes, the CSV is present, and readable/writable. (As I mentioned, the same script runs if called directly.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, I'm on ArcGIS 10.x, and I happen to be using a virtualenv based on ArcGIS's python installation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if you have any ideas.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jamie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 14:38:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32646#M2584</guid>
      <dc:creator>JamieJackson</dc:creator>
      <dc:date>2011-09-06T14:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Exposing Arcpy Python Script to Web</title>
      <link>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32647#M2585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jamie,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you succeed with arcpy + flask? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to test this web solution, but I'd like to have some background experience on this before starting. The goal is to create a simple map export with arcpy.mapping through a web browser.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Olivier.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 08:50:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exposing-arcpy-python-script-to-web/m-p/32647#M2585</guid>
      <dc:creator>olivierthomas</dc:creator>
      <dc:date>2013-03-27T08:50:29Z</dc:date>
    </item>
  </channel>
</rss>

