tonycpsu / streamglob

A console media browser designed to facilitate live and time-shifted viewing of online content.
GNU General Public License v3.0
35 stars 10 forks source link

Missing resources/css file #65

Open fang2415 opened 1 year ago

fang2415 commented 1 year ago

Not sure whether this repo is still alive, but: I'm trying to bring streamglob up to date and am getting this traceback, on several different devices, after updating to 674f3ed0c2, running pip install -U . and then streamglob:

$ streamglob
Traceback (most recent call last):
  File "/home/fang2415/.pyenv/versions/3.7.2/bin/streamglob", line 11, in <module>
    load_entry_point('streamglob==0.0.11.dev0', 'console_scripts', 'streamglob')()
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/streamglob/__main__.py", line 45, in <module>
    from .state import *
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/streamglob/state.py", line 10, in <module>
    from . import config
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/streamglob/config.py", line 22, in <module>
    from .utils import classproperty
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/streamglob/utils.py", line 20, in <module>
    with pkg_resources.path(resources, "css") as css_path:
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/importlib/resources.py", line 201, in path
    with open_binary(package, resource) as fp:
  File "/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/importlib/resources.py", line 91, in open_binary
    return reader.open_resource(resource)
  File "<frozen importlib._bootstrap_external>", line 929, in open_resource
FileNotFoundError: [Errno 2] No such file or directory: '/home/fang2415/.pyenv/versions/3.7.2/lib/python3.7/site-packages/streamglob/resources/css'

Anybody know how to proceed here?

tonycpsu commented 1 year ago

Not sure... I'd try a pip uninstall streamglob and then re-run pip install .

fang2415 commented 1 year ago

Hey glad to see the repo is still in action! (Especially now that https://github.com/kmac/mlbv is on hiatus.)

Unfortunately uninstalling and reinstalling (at 3e63312ef9) produces the same result. I did get a deprecation notice from pip saying that

streamglob is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed

Installing wheel and re-uninstalling-and-installing mlbstreamer removed the deprecation notice but produced the same traceback when streamglob is run.

I'm a little surprised that nobody else is running into a similar problem since I'm seeing it on two different machines (although admittedly they're configured similarly). Is there any info about my setup that might help? Or recommendations of where to look to debug further?

dyep49 commented 1 year ago

I was also having this issue.

I worked around it by commenting out lines 20 and 21 from utils.py:

fang2415 commented 1 year ago

I worked around it by commenting out lines 20 and 21 from utils.py:

Ah, terrific, that along with an update of my config file did the trick!

@tonycpsu, would you consider a PR for this fix, or would it break something else?

GTRcktSci commented 1 year ago

I was also having this issue.

I worked around it by commenting out lines 20 and 21 from utils.py:

Having the same issue. I commented these two lines, but the same error still shows up, not sure what i'm doing wrong. Any suggestions?

GTRcktSci commented 1 year ago

I worked around it by commenting out lines 20 and 21 from utils.py:

Ah, terrific, that along with an update of my config file did the trick!

@tonycpsu, would you consider a PR for this fix, or would it break something else?

Were the updates to your config file related to this issue?

fang2415 commented 1 year ago

Were the updates to your config file related to this issue?

No, I think it was just out of date. IIRC I commented out those two lines and did pip install ., from which point I didn't see the FileNotFoundError again. But then I think on the first run streamglob crashed because of a missing dependency; then after installing that it crashed due to an out-of-date sqlite DB that it had to rebuild; and after that there was a missing entry in the config file without which I got a Python error about trying to compare a Tree with an int. Reinstalling the sample config file as described in the README got everything up and running.

It seems strange that the same error is still showing up for you... I guess if I were you I'd double-check that you're on the most recent update (3e63312ef9605d2ebb2e9f303c7aac8d83bad750), then do @dyep49's fix again, then retry @tonycpsu's suggestion to reinstall using pip uninstall streamglob and then pip install .. Then if it's still giving you the FileNotFoundError, do what I probably should have done in the first place and run grep -r css to see if there's anywhere else in the code that you could comment out to stop it trying to get at that non-existent css file...

tonycpsu commented 1 year ago

See if pulling the latest main branch fixes this. Not really sure what else to do since I can't reproduce locally.

fang2415 commented 1 year ago

Working for me at 09301bff87, many thanks @tonycpsu!

Out of curiosity, do you actually have a file at streamglob/resources/css? Because I clearly don't, and I don't see it here either, so I'm curious why you're not seeing the same error as I was. Maybe the file fell out of version control somehow?

Anyway, if that makes you nervous then let me know if I can help debug further. But the code with the new repair seems to be working for me.

tonycpsu commented 1 year ago

Welp that'd do it. Yeah it's there now.

fang2415 commented 1 year ago

Aha! The puzzle is solved! All working for me at de8c50cb3.

GTRcktSci commented 1 year ago

I'm still getting a similar error (and I'm sure it's something dumb I'm doing or not doing

`Traceback (most recent call last): File "/usr/local/bin/streamglob", line 5, in from streamglob.main import main

File "/usr/local/lib/python3.9/dist-packages/streamglob/main.py", line 45, in from .state import *

File "/usr/local/lib/python3.9/dist-packages/streamglob/state.py", line 10, in from . import config

File "/usr/local/lib/python3.9/dist-packages/streamglob/config.py", line 22, in from .utils import classproperty

File "/usr/local/lib/python3.9/dist-packages/streamglob/utils.py", line 27, in with pkg_resources.path(resources, "css") as css_path:

File "/usr/lib/python3.9/contextlib.py", line 117, in enter return next(self.gen)

File "/usr/lib/python3.9/importlib/resources.py", line 175, in _path_from_reader opener_reader = reader.open_resource(norm_resource)

File "", line 995, in open_resource IsADirectoryError: [Errno 21] Is a directory: '/usr/local/lib/python3.9/dist-packages/streamglob/resources/css'`

I tried uninstalling as well as starting over to make sure I was getting the latest main branch. Any nudging in the right direction would be greatly appreciated

GTRcktSci commented 1 year ago

But then I think on the first run streamglob crashed because of a missing dependency; then after installing that it crashed due to an out-of-date sqlite DB that it had to rebuild; and after that there was a missing entry in the config file without which I got a Python error about trying to compare a Tree with an int. Reinstalling the sample config file as described in the README got everything up and running.

I think I'm following along the same path you did @fang2415 - i had a missing dependency (MagickWand lib) and now i'm getting an sqlite db error. Can you give some additional details on the "out-of-date sqlite db it had to rebuild"? What did you have to do to rebuild the db?

TIA

fang2415 commented 1 year ago

I think I'm following along the same path you did @fang2415 - i had a missing dependency (MagickWand lib) and now i'm getting an sqlite db error. Can you give some additional details on the "out-of-date sqlite db it had to rebuild"? What did you have to do to rebuild the db?

So I think that one was solved by just running streamglob twice -- the first time it crashed with the db error, the second time it looked like it moved the bad db to a backup and started up a new one. I think if that hadn't worked, my next step would have been to manually move that db file or possibly all the old stuff in the config directory (which for me is at ~/.config/streamglob) in order to clear all the caches and session info and whatever else is in there that might be preserving some kind of bad state. If you move config.yaml you'll have to set it up again using the instructions in the README (which is what sorted out my last hitch), but I think the rest of the stuff in that config directory should get set up automatically on first run?

And if none of that works then maybe @dyep49's solution will keep things running so you can at least watch some baseball while you continue to debug?