App does not start

Hello, currently I am building a multipage App with dcc.Store components. My problem is that when I start the App I receive the following errormessage:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\__main__.py", line 39, in <module>
    cli.main()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy/..\debugpy\server\cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "c:\program files\microsoft visual studio\2022\community\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "C:\Users\User\Desktop\Business\Stonks\Stonks\Stonks.py", line 8, in <module>
    app = Dash(__name__, use_pages=True, external_stylesheets=[dbc.themes.CYBORG])
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\dash\dash.py", line 504, in __init__
    self.init_app()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\dash\dash.py", line 588, in init_app
    self.enable_pages()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\dash\dash.py", line 2041, in enable_pages
    self._import_layouts_from_pages()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\dash\dash.py", line 2005, in _import_layouts_from_pages
    content = f.read()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 6218: invalid start byte

Funny thing is the App worked and then suddenly after doing small changes it stopped working. Can anybody help me out?
Press any key to continue . . .

Hi @cosco,

It would be nice to share the small changes you made that started the problem. The right question is almost always, what has changed.

Ps: please try to format your output / code correctly so its easier for anyone to help out

Thanks
j.

I just did a quick search on the error:

Not sure if it helps but give it a try

Hello jcuypers,
I first changed the app layout (made big changes according to DRY principle) and everything worked fine (exept there was an error message appearing " ID not found in layout").
Then I changed the input paramaters in a pandas dataframe calculation of a class (extended it so that there was one more nominator) After starting the app I received the error message. I cannot do anything anymore. I deleted the changes but I still cannot start the App anymore :frowning: Best Regards, Clemens

I don’t really know but a troubleshooting approach would be setting use_pages to false . If that works remove pages one by one to see which one has the problem (like.not register them)

And once you find the one see what’s wrong with it . Maybe if you run it standalone it would be easier to troubleshoot (like a simple app which tests the specific functionality and removing all not necessary things to pinpoint the exact code (or debug line per line)

1 Like

Disregards this for now

Hello jcuypers thank you for the advice. I made a comment which contains the letters “öö” by mistake. I didnt recognize it. Now it works again. Thank you so much!

1 Like

Normally vscode ,/ visual studio has tools to help you with these kind of things to visually indicate something’s off. Good luck

1 Like