dynobo / normcap

OCR powered screen-capture tool to capture information instead of images
https://dynobo.github.io/normcap/
Other
1.96k stars 89 forks source link

[ERROR] Not launching in Fedora 35 Wayland #153

Closed nesper8 closed 2 years ago

nesper8 commented 3 years ago

Log:

19:12:31 - INFO - normcap.normcap - Starting NormCap v0.1.13 ...
Traceback (most recent call last):
  File "/home/nep/.local/bin/normcap", line 8, in <module>
    sys.exit(run())
  File "/home/nep/.local/lib/python3.10/site-packages/normcap/__main__.py", line 5, in run
    _ = main()
  File "/home/nep/.local/lib/python3.10/site-packages/normcap/normcap.py", line 171, in main
    normcap_data = client_code(capture, normcap_data)
  File "/home/nep/.local/lib/python3.10/site-packages/normcap/normcap.py", line 122, in client_code
    result = handler.handle(normcap_data)
  File "/home/nep/.local/lib/python3.10/site-packages/normcap/handlers/capture_handler.py", line 44, in handle
    request = self._take_screenshot_alternative(request)
  File "/home/nep/.local/lib/python3.10/site-packages/normcap/handlers/capture_handler.py", line 101, in _take_screenshot_alternative
    img_complete = ImageGrab.grab(backend="gnome-screenshot")
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/__init__.py", line 30, in grab
    return backend_grab(backend, bbox, childprocess)
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/loader.py", line 156, in backend_grab
    return force(backend, bbox, childprocess)
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/loader.py", line 150, in force
    im = obj.grab(bbox)
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/plugins/gnome_screenshot.py", line 27, in grab
    im = read_prog_img([PROGRAM, "-f"])
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/tempexport.py", line 27, in read_prog_img
    im = read_func_img(run_prog)
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/tempexport.py", line 15, in read_func_img
    func(filename, bbox)
  File "/home/nep/.local/lib/python3.10/site-packages/pyscreenshot/tempexport.py", line 25, in run_prog
    raise RunProgError(p.stderr)
pyscreenshot.tempexport.RunProgError: ** Message: 19:12:31.876: Unable to use GNOME Shell's builtin screenshot interface, resorting to fallback X11.

(gnome-screenshot:15494): Gdk-CRITICAL **: 19:12:31.876: gdk_pixbuf_get_from_surface: assertion 'width > 0 && height > 0' failed

(gnome-screenshot:15494): GdkPixbuf-CRITICAL **: 19:12:31.876: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:15494): GdkPixbuf-CRITICAL **: 19:12:31.876: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

(gnome-screenshot:15494): GdkPixbuf-CRITICAL **: 19:12:31.876: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:15494): GdkPixbuf-CRITICAL **: 19:12:31.876: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:15494): Gtk-CRITICAL **: 19:12:31.906: gtk_window_resize: assertion 'width > 0' failed

** (gnome-screenshot:15494): CRITICAL **: 19:12:31.906: Unable to capture a screenshot of any window
dynobo commented 3 years ago

Thanks for reporting this issue!

Which Desktop Environment are you using? Gnome Shell? If yes, which version? gnome-shell --version

dynobo commented 3 years ago

Oh, on the second look, I've noticed that you are using the very old version v0.1.13. Can please update and try again? (Or do you have a reason why you are using that old one?)

nesper8 commented 3 years ago

GNOME Shell 41.1

Im using the pip version actually which is not upgrade after pip install --upgrade normcap

nesper8 commented 3 years ago

This comes on the latest AppImage

Traceback (most recent call last):
  File "/tmp/.mount_NormCaT2VKlT/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/tmp/.mount_NormCaT2VKlT/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/.mount_NormCaT2VKlT/usr/app/normcap/__main__.py", line 3, in <module>
    from normcap.app import main
  File "/tmp/.mount_NormCaT2VKlT/usr/app/normcap/app.py", line 20, in <module>
    from PySide2 import QtCore, QtNetwork, QtWidgets
ImportError: /tmp/.mount_NormCaT2VKlT/usr/lib/python3.7/lib-dynload/../../libcrypto.so.1.1: version `OPENSSL_1_1_1b' not found (required by /lib64/libk5crypto.so.3)
dynobo commented 2 years ago

Hey @nesper8, I identified the root-cause. As other users are affected, I decided to track the issue in #159. Please follow that issue to get informed about updates.

dynobo commented 2 years ago

@nesper8 The error you see in AppImage is a different one. It seems like some dependencies are not getting properly packed. Looking into that one, too.

dynobo commented 2 years ago

@nesper8, I just released the v0.2.10, it should fix the your first error, but it doesn't yet solve the appimage dependency issue.

However, as the Python package shouldn't have any dependency issue (because you have to install the deps on your own ;) it would be awesome if you could test the v0.2.10 from pypi.org and report back how it works for you :-)

nesper8 commented 2 years ago

I... uh switched to windows so really cant test it out

nesper8 commented 2 years ago

back on fedora again pip version works pretty well

would love to see if it would remove the dependancy for xclip sometime in the future

dynobo commented 2 years ago

@nesper8 Oh, if I remember correctly xclip shouldn't be a dependency anymore. It was dropped as dependency quit some time ago... Did I miss this somewhere in the documentation?

Another idea: Is it possible, that you installed an older version of NormCap? ( check version with pip list | grep normcap) This can happen, if you are installing with Python 3.10+, as an older version once was compatible, but the current version isn't (yet).

nesper8 commented 2 years ago

yeah looks like i have an older version 0.1.13 spcifically due to python3.10+

cant remove python3.10 cuz it breaks gnome on fedora

the AppImage version still has that openssl dependancy error

/usr/bin/AppImageLauncher: /lib64/libcurl.so.4: no version information available (required by /usr/bin/../lib/x86_64-linux-gnu/appimagelauncher/libappimageupdate.so)
QSocketNotifier: Can only be used with threads started with QThread
Traceback (most recent call last):
  File "/tmp/.mount_NormCaShw0Dl/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/tmp/.mount_NormCaShw0Dl/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/.mount_NormCaShw0Dl/usr/app/normcap/__main__.py", line 3, in <module>
    from normcap.app import main
  File "/tmp/.mount_NormCaShw0Dl/usr/app/normcap/app.py", line 20, in <module>
    from PySide2 import QtCore, QtWidgets
ImportError: /tmp/.mount_NormCaShw0Dl/usr/lib/python3.7/lib-dynload/../../libcrypto.so.1.1: version `OPENSSL_1_1_1b' not found (required by /lib64/libk5crypto.so.3)
dynobo commented 2 years ago

Thx for trying and reporting back, @nesper8 ! :blush:

Yes, I couldn't solve the openssl issue in the appimage (yet).

No need to uninstall your system's Python version in order to use a different version: It is quite common to install different versions in parallel, afaik pyenv is the most popular tool for that.

However, if you are not familiar with pyenv, I'd recommend you just keep using the (older) NormCap version if that works for you. You can still switch to a new version, once the openssl issue is solved or I was able to make it ready for Python 3.10. :-)

nesper8 commented 2 years ago

no worries mate after rigorous testing i finally got the latest version working through the magic of shell scripts after cloning latest stable build i created a shell script at project root containing this

#!/bin/sh
STARTDIR=$(pwd)
TOML_DIR=$(dirname "$0")
cd "$TOML_DIR" || exit
poetry run python -m normcap

and created a keyboard event on gnome settings to execute this shell script