r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.62k stars 537 forks source link

Discord not loading in pywebview. #539

Closed IoIxD closed 4 years ago

IoIxD commented 4 years ago

Trying to build a very basic web browser with pywebview, most websites render find except for Discord, which results in a blank screen. Once or twice I have gotten it to load the body's background color, which is blueish grey, but it loads nothing beyond that. Enabling debug and going to the console reveals errors that I get when trying to access the site through a regular web browser as well.

I am running the most bare bones code imaginable, as my goal is to create a simple web browser that you activate via the command line:

#!/usr/bin/python
import webview
webview.create_window('Browser', 'https://www.discord.com/app')
webview.start(debug=True)

If it helps, Discord is built on React, which is known not to load at all in some configurations or on some older hardware. I'm not sure if this is relevant, and the page loads fine in a regular web browser on the same computer, but I thought it was worth mentioning.

IoIxD commented 4 years ago

Update: I just realized I can interact with the login page. But nothing renders.

r0x0r commented 4 years ago

I just tested on macOS, it works fine. Looks like it is a web renderer issue. Are you using GTK or QT? In any case could you try the other renderer? A long-term solution would be bringing CEF to GTK.

IoIxD commented 4 years ago

I'm using GTK. How would I switch to a different renderer?

r0x0r commented 4 years ago

https://pywebview.flowrl.com/guide/renderer.html https://pywebview.flowrl.com/guide/renderer.html

IoIxD commented 4 years ago

PyQt5 isn't worth the hassle to install. Guess the project is over, then...

r0x0r commented 4 years ago

You can install it with just pip install pywebview[qt]

IoIxD commented 4 years ago

And just like when I tried to install it regularly, the sip package is to blame for one reason or another...

gavin@funny:~
$ python3 -m pip install pywebview[qt]
Defaulting to user installation because normal site-packages is not writeable
Collecting pywebview[qt]
  Using cached pywebview-3.2-py3-none-any.whl (115 kB)
Collecting PyQt5; extra == "qt"
  Downloading PyQt5-5.15.0.tar.gz (3.3 MB)
     |████████████████████████████████| 3.3 MB 2.3 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 /home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpnhe846mf
         cwd: /tmp/pip-install-pil00y4w/PyQt5
    Complete output (31 lines):
    Traceback (most recent call last):
      File "/home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 131, in prepare_metadata_for_build_wheel
        config_settings)
      File "/home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/sipbuild/api.py", line 51, in build_wheel
        project = AbstractProject.bootstrap('pep517')
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/sipbuild/abstract_project.py", line 82, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/sipbuild/project.py", line 477, in setup
        self.apply_user_defaults(tool)
      File "project.py", line 62, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/pyqtbuild/project.py", line 86, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/sipbuild/project.py", line 223, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-m4_o2lmj/overlay/lib/python3.7/site-packages/pyqtbuild/builder.py", line 68, in apply_user_defaults
        "specify a working qmake or add it to PATH")
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/gavin/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpnhe846mf Check the logs for full command output.
gavin@funny:~
$ 
IoIxD commented 4 years ago

Tried it with sudo as well, to no avail, although I did get a different error.

gavin@funny:~
$ sudo python3 -m pip install pywebview[qt]
[sudo] password for gavin: 
Collecting pywebview[qt]
  Downloading https://files.pythonhosted.org/packages/c6/54/578dfa87c4d8bb6cb2c3618223feb33ebbd0f54b6af53fcd75c2231e9d48/pywebview-3.2-py3-none-any.whl (115kB)
    100% |████████████████████████████████| 122kB 847kB/s 
Collecting pyqtwebengine; extra == "qt" (from pywebview[qt])
  Downloading https://files.pythonhosted.org/packages/0d/8d/aece7598d2959f66f09fcced6487dd7727f44ad867fc09978c5aeeaf1d29/PyQtWebEngine-5.15.0.tar.gz (48kB)
    100% |████████████████████████████████| 51kB 1.2MB/s 
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-8q7ygmpm/pyqtwebengine/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-8q7ygmpm/pyqtwebengine/
gavin@funny:~
$ 
r0x0r commented 4 years ago

Regarding the latter error, you need to update your pip installation first.