jdalbey / libbyfetch

A Python program for downloading MP3 audiobooks from libbyapp.com website
MIT License
13 stars 5 forks source link

No module named 'blinker._saferef' #2

Closed p1nkyy closed 1 week ago

p1nkyy commented 1 week ago

Apologies, I don't understand much about how to use python but mine came back with this error

D:\Installer\libbyfetch-main>python libbyfetch.py
Traceback (most recent call last):
  File "D:\Installer\libbyfetch-main\libbyfetch.py", line 10, in <module>
    from seleniumwire import webdriver

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\webdriver.py", line 28, in <module>
    from seleniumwire import backend, utils

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\backend.py", line 4, in <module>
    from seleniumwire.server import MitmProxy

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\server.py", line 5, in <module>
    from seleniumwire.handler import InterceptRequestHandler

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\handler.py", line 5, in <module>
    from seleniumwire import har

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\har.py", line 11, in <module>
    from seleniumwire.thirdparty.mitmproxy import connections

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\connections.py", line 10, in <module> from seleniumwire.thirdparty.mitmproxy.net import tls, tcp

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\net\tls.py", line 15, in <module> import seleniumwire.thirdparty.mitmproxy.options

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\options.py", line 5, in <module>
    from seleniumwire.thirdparty.mitmproxy import optmanager

  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\optmanager.py", line 9, in <module>
    import blinker._saferef

ModuleNotFoundError: No module named 'blinker._saferef'

I tried to install blinker._saferef but it doesn't work, saying can't find a version that match.

jdalbey commented 1 week ago

I suspect that it's a version incompatibility problem. It's probably the case that you have blinker version 1.9.0 installed. V1.9.0 doesn't seem to play nice with Selenium. I solved this by uninstalling blinker and reinstalling blinker version 1.7.0. Here are the detailed steps, using pip. pip show blinker This should reveal the version is 1.9.0 pip uninstall blinker Uninstall the module pip install blinker==1.7.0 Install blinker with the specific version we want pip show blinker Should now have version 1.7 installed. Now libbyfetch.py should execute without that error. There is a remark under "Requirements" in the README about the need to downgrade.

p1nkyy commented 1 week ago

That works but now I encountered another error. It's unrelated I believe so I'm sorry to put it here as well.

`Starting signin with your library card.
Card Number set successfully.
'Next' Button clicked.
PIN entered.
Created TensorFlow Lite XNNPACK delegate for CPU.
An error occurred finding Sign In button: Message:
Stacktrace:
        GetHandleVerifier [0x00007FF73A9938A5+3004357]
        (No symbol) [0x00007FF73A629970]
        (No symbol) [0x00007FF73A4D582A]
        (No symbol) [0x00007FF73A525B8E]
        (No symbol) [0x00007FF73A525E7C]
        (No symbol) [0x00007FF73A56EC27]
        (No symbol) [0x00007FF73A54BC1F]
        (No symbol) [0x00007FF73A56BA4C]
        (No symbol) [0x00007FF73A54B983]
        (No symbol) [0x00007FF73A517628]
        (No symbol) [0x00007FF73A518791]
        GetHandleVerifier [0x00007FF73A9BA00D+3161901]
        GetHandleVerifier [0x00007FF73AA0E060+3506048]
        GetHandleVerifier [0x00007FF73AA0400D+3465005]
        GetHandleVerifier [0x00007FF73A780EEB+830987]
        (No symbol) [0x00007FF73A63467F]
        (No symbol) [0x00007FF73A6309D4]
        (No symbol) [0x00007FF73A630B6D]
        (No symbol) [0x00007FF73A620149]
        BaseThreadInitThunk [0x00007FFC73187614+20]
        RtlUserThreadStart [0x00007FFC751626B1+33]`

Then that's it, no other process done.

jdalbey commented 1 week ago

Weird. I wonder if it is similar to https://github.com/jdalbey/libbyfetch/issues/3. I am still diagnosing that problem. One possible workaround is to modify the code to use Firefox instead of Chrome (assuming you have Firefox installed). To do this, in the file libbyfetch.py replace lines 364-367 with these:

        from selenium.webdriver.firefox.options import Options as FirefoxOptions
        options = FirefoxOptions()
        options.add_argument("--headless")
        driver = webdriver.Firefox(options=options)
p1nkyy commented 1 week ago

Now it doesn't work at all....

`Initializing LibbyApp
Abnormal exit. Message: Process unexpectedly closed with status 0

Traceback (most recent call last):
  File "D:\Installer\libbyfetch-main\libbyfetch.py", line 367, in <module>
    driver = webdriver.Firefox(options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\webdriver.py", line 179, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 238, in __init__
    self.start_session(capabilities)
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 325, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 380, in execute
    self.error_handler.check_response(response)
  File "C:\Users\XYZ\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Installer\libbyfetch-main\libbyfetch.py", line 379, in <module>
    driver.quit()
    ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'quit'`
jdalbey commented 1 week ago

Updated the README file to include steps for installing Blinker v1.7.0. Also, a fix has been submitted for #3.