Are wFastCGI & Python API compatible?

1891
3
Jump to solution
09-28-2020 01:47 PM
JasonWise1
New Contributor

I'm trying to write a web service that gets data from ArcGIS Portal, even though that might seem redundant. I'm using IIS, wFastCGI, Flask, and the ArcGIS API for Python. The service runs fine on localhost using Flask's web server, but it fails when I run it with IIS and wFastCGI. When I import arcgis, it imports ipywidgets, which imports IPython. IPython tries to do something with the input stream (stdin), but wFastCGI has already hijacked the input stream for its own purposes. Here's how it ends:

...\lib\site-packages\IPython\utils\io.py", line 81, in closed
  return self.stream.closed
ValueError: underlying buffer has been detached


In other words, wFastCGI appears to be incompatible with IPython, which makes wFastCGI incompatible with the ArcGIS API for Python. One of the frustrating things about this is that I don't need IPython, but I can't avoid importing it.

Apparently at least one person has gotten something similar to work. Is it possible for wFastCGI and the Python API to coexist?

0 Kudos
1 Solution

Accepted Solutions
VictorTey
Esri Contributor

Hi Jason Wise‌,

You can uninstall ipython;

Workaround is to run pip uninstall ipython 

The error I had was slightly different though,

After importing arcgis, I encountered the error (Underlying buffer detached).

1 ValueError: underlying buffer has been detached

There were several other issues I encountered. The other one was the wrong user environment which I had to manually change in code. See my documentation attached.

View solution in original post

3 Replies
VictorTey
Esri Contributor

Hi Jason Wise‌,

You can uninstall ipython;

Workaround is to run pip uninstall ipython 

The error I had was slightly different though,

After importing arcgis, I encountered the error (Underlying buffer detached).

1 ValueError: underlying buffer has been detached

There were several other issues I encountered. The other one was the wrong user environment which I had to manually change in code. See my documentation attached.

JasonWise1
New Contributor

Wow, thanks! I thought uninstalling IPython would just cause an import error, but it didn't.

Now I can get back to working on the various authentication problems. Thanks for the PDF! I wrote something similar about setting up Flask with IIS, which worked until I added ArcGIS to the mix. I'll read yours and add to mine.

0 Kudos
LukeWebb
Occasional Contributor III

Hi Victor,

 

We have the same issue, but the arcgis.mapping  WebMap()  class has dependancies to ipython.  Any other ideas for how to interact with a webmap through wfastcgi and the api?

0 Kudos