Error while Running App on Chrome Brwoser

Hi,
I’m trying hard to run one of the tutorials from plotly dash. Whenever I run the code in Spyder, and then I open the http://127.0.0.1:8050/ on google chrome, it never runs the app. I tried so many solutions from the various platforms but still struggling.
I would appreciate your help in this regard.

TIA

Please post the pic of your error or you code, so that i can help you better :slight_smile:

On Line 6 change app = dash.Dash(name)
still you face the same error then change the line 34

app.run_server(debug=True,port=8050,use_reloader=False)

I tried it…still not working.

I don’t see anything obviously wrong (though assuming you’re on dash version >= 1.0 you don’t need the serve_locally lines, that’s the default now).

But at the end of the console it says “An exception has occured, use %tb to see the full traceback” - can you do that? Presumably that will help us see what went wrong.

Traceback (most recent call last):

File “”, line 1, in
runfile(‘C:/Users/atunk/Documents/Python Scripts/Test/untitled2.py’, wdir=‘C:/Users/atunk/Documents/Python Scripts/Test’)

File “C:\Users\atunk\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 827, in runfile
execfile(filename, namespace)

File “C:\Users\atunk\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 110, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)

File “C:/Users/atunk/Documents/Python Scripts/Test/untitled2.py”, line 21, in
app.run_server(debug=True, host=‘127.0.0.1’,port=8003)

File “C:\Users\atunk\Anaconda3\lib\site-packages\dash\dash.py”, line 1829, in run_server
self.server.run(port=port, debug=debug, **flask_run_options)

File “C:\Users\atunk\Anaconda3\lib\site-packages\flask\app.py”, line 990, in run
run_simple(host, port, self, **options)

File “C:\Users\atunk\Anaconda3\lib\site-packages\werkzeug\serving.py”, line 1008, in run_simple
run_with_reloader(inner, extra_files, reloader_interval, reloader_type)

File “C:\Users\atunk\Anaconda3\lib\site-packages\werkzeug_reloader.py”, line 339, in run_with_reloader
sys.exit(reloader.restart_with_reloader())

The above error appears after %tb.

Hmm, does look spyder might not work well with hot reloading as @bala_bala implied. In addition to the option he mentioned, we have another piece of hot reloading (for js, css, etc) that you might try turning off:

app.run_server(debug=True, use_reloader=False, dev_tools_hot_reload=False)

I’m not real familiar with spyder though, anyone else know what’s going on here? Worst case you can run the app from a separate terminal window, though that’s obviously not ideal.

Thanks for your input. I’m only able to run the app via jupyter.
One more query, I have to change every time the port=xxxx, otherwise it only runs the preveous app with that port. I meant I can’t run two different apps with the same port like port=8080.

You want to run two apps simultaneously on the same port? You’d have to put them on the same flask server with different prefixes, or put another server in front. There have been some discussions about that like Hosting multiple Dash apps with uWSGI + Nginx (but note the API has evolved since then)

If you mean you’re done with one app and want to run another on the same port, I’ve only seen that mean the previous app is still running - you just have to ensure it’s really stopped before starting the second one.

Happy to help sort it out if you can give some more details about the symptoms you’re seeing.

dash error as follows:
Running on http://127.0.0.1:8050/
Debugger PIN: 103-292-731
Traceback (most recent call last):
File “C:/Users/manish.podugu/AppData/Local/Programs/Python/Python37/apps.py”, line 35, in
app.run_server(debug=True)
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\dash\dash.py”, line 2026, in run_server
self.server.run(port=port, debug=debug, **flask_run_options)
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py”, line 985, in run
cli.show_server_banner(self.env, self.debug, self.name, False)
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\cli.py”, line 670, in show_server_banner
click.echo(message)
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\click\utils.py”, line 218, in echo
file = _default_text_stdout()
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\click_compat.py”, line 675, in func
rv = wrapper_func()
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\click_compat.py”, line 436, in get_text_stdout
rv = _get_windows_console_stream(sys.stdout, encoding, errors)
File “C:\Users\manish.podugu\AppData\Local\Programs\Python\Python37\lib\site-packages\click_winconsole.py”, line 295, in _get_windows_console_stream
func = _stream_factories.get(f.fileno())
io.UnsupportedOperation: fileno

It is not recommended to run Dash with Spyder, but it can be done.

Instead app.run_server, Try:

server = flask.Flask(__name__)
app = dash.Dash(__name__, server = server,])
app.run_server()