I have deployed Flask Server on IIS. I'm getting below error while importing IPython module in my code.
I have tried IPython
version: 5.0, 6.0, 7.16.3
but still
When i run my code through cmd it works and server on localhost starts. But when hosted through IIS Server below issue remains If I keep import IPython
line in code.
My python config:
python 3.6
Flask==1.1.2
Keras==2.1.3
scikit-learn==0.23.2
scipy==1.4.1
tensorflow==1.14.0
wfastcgi==3.0.0
Heres my code:
from flask import Flask
import IPython
app = Flask(__name__)
@app.route("/flaskapi2/")
def hello():
return "Hello from FastCGI via IIS!"
if __name__ == "__main__":
app.run()
Error:
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "E:\deploy_car_damage\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "E:\deploy_car_damage\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "E:\deploy_car_damage\wfastcgi.py", line 600, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File ".\main.py", line 2, in <module>
import IPython
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\__init__.py", line 56, in <module>
from .terminal.embed import embed
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\terminal\embed.py", line 15, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\core\interactiveshell.py", line 63, in <module>
from IPython.utils import io
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 94, in <module>
stdin = IOStream(sys.stdin, fallback=devnull)
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 38, in __init__
for meth in filter(clone, dir(stream)):
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 37, in clone
return not hasattr(self, meth) and not meth.startswith('_')
File "E:\deploy_car_damage\venv36\lib\site-packages\IPython\utils\io.py", line 81, in closed
return self.stream.closed
ValueError: underlying buffer has been detached
StdOut:
StdErr:
What does underlying buffer has been detached
mean and how can I resolve it.