When I run the following code, I get the error message: "UnsupportedOperation: not writable":
from flask import Flask
app_flask = Flask(__name__)
@app_flask.route('/')
def hello_method():
return "Hello, main page!"
if __name__ == '__main__':
app_flask.run()
Can anyone offer some guidance? I know there's another question like this one, but the answers were not helpful at all. Here's the rest of the error message:
Traceback (most recent call last):
File "<ipython-input-13-a122d150300b>", line 20, in <module>
app_flask.run()
File "C:\anaconda3\lib\site-packages\flask\app.py", line 938, in run
cli.show_server_banner(self.env, self.debug, self.name, False)
File "C:\anaconda3\lib\site-packages\flask\cli.py", line 629, in show_server_banner
click.echo(message)
File "C:\anaconda3\lib\site-packages\click\utils.py", line 259, in echo
file.write(message)
UnsupportedOperation: not writable
I found the answer here, courtesy of josechval: https://github.com/plotly/dash/issues/257
Jose says: "You need to edit the "echo" function definition at ../site-packages/click/utils.py . The default value for the "file" parameter must be sys.stdout instead of None. Do the same for the "secho" function definition at ../site-packages/click/termui.py"
Another solution from the same issue already quoted:
Downgrade flask:
conda install flask=0.12.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With