Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug mode often fails to load resources #1025

Closed
geekzsp opened this issue Jan 31, 2023 · 8 comments
Closed

debug mode often fails to load resources #1025

geekzsp opened this issue Jan 31, 2023 · 8 comments

Comments

@geekzsp
Copy link

geekzsp commented Jan 31, 2023

Specification

  • pywebview version: 4.0.1
  • operating system: win10
  • web renderer: WinForms / Chromium

Description

When I use the debug=True, http_server=True, I often run into situations where I can't load front-end resources

image

Resources are loaded only after multiple restarts
image

Practicalities

  • YES I am willing to work on this issue myself.
@r0x0r
Copy link
Owner

r0x0r commented Jan 31, 2023

What do server requests looks like in Network tab of the dev tools?

@geekzsp
Copy link
Author

geekzsp commented Jan 31, 2023

What do server requests looks like in Network tab of the dev tools?

No request.When I tried to access port 42001 in my browser, it took a long time to respond

@r0x0r
Copy link
Owner

r0x0r commented Jan 31, 2023

There is a similar issue here #1020
According to the op, it is caused by a virtual environment. Can you test whether this is the case for you as well?

@geekzsp
Copy link
Author

geekzsp commented Jan 31, 2023

There is a similar issue here #1020 According to the op, it is caused by a virtual environment. Can you test whether this is the case for you as well?

This may not be the case. I am running a packaged pyinstaller application. no virtual environment

@r0x0r
Copy link
Owner

r0x0r commented Jan 31, 2023

Sounds like this might be caused by the default single-threaded server. Maybe switching to paste or similar would help. https://bottlepy.org/docs/dev/deployment.html#server-options

Would you able to give it a go?

@geekzsp
Copy link
Author

geekzsp commented Jan 31, 2023

Sounds like this might be caused by the default single-threaded server. Maybe switching to paste or similar would help. https://bottlepy.org/docs/dev/deployment.html#server-options

Would you able to give it a go?

   server.thread = threading.Thread(
            target=lambda: bottle.run(app=app, port=server.port, quiet=not _debug['mode'], server='cheroot'),
            daemon=True)

According to the documentation, after setting multithreading mode, it worked fine ,Thank you

@r0x0r
Copy link
Owner

r0x0r commented Feb 3, 2023

I have implemented a simple multithreaded server in https://github.com/r0x0r/pywebview/tree/multithreaded-server branch. @geekzsp would you be able to test it and see if it solves the problem?

@geekzsp
Copy link
Author

geekzsp commented Feb 6, 2023

I have implemented a simple multithreaded server in https://github.com/r0x0r/pywebview/tree/multithreaded-server branch. @geekzsp would you be able to test it and see if it solves the problem?

It's perfect

@r0x0r r0x0r closed this as completed Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants