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

Timeout Exception after a few searches as in #185 #221

Open
2 tasks done
iDarkSnow opened this issue Nov 5, 2024 · 23 comments
Open
2 tasks done

Timeout Exception after a few searches as in #185 #221

iDarkSnow opened this issue Nov 5, 2024 · 23 comments
Labels
bug Something isn't working

Comments

@iDarkSnow
Copy link

Before submitting a bug report...

  • This bug wasn't already reported.
    (I have checked every bug report on GitHub)

  • I've cleared the sessions folder.

Branch

master

Commit

Latest

Describe the bug

After a few searches, on both the accounts, the script stops with a TimeoutException. This bug was already reported in #185 and it seemed to be solved in a future commit, but it still happens on my end.

Copy and paste your error

[38;21m2024-11-05 09:32:01,025 [DEBUG] in exit exc_type=<class 'selenium.common.exceptions.TimeoutException'> exc_value=Message:
Stacktrace:
GetHandleVerifier [0x003738B3+24035]
(No symbol) [0x002FBC44]
(No symbol) [0x001DC2D3]
(No symbol) [0x0021DC86]
(No symbol) [0x0021DECB]
(No symbol) [0x0025B9D2]
(No symbol) [0x0023FED4]
(No symbol) [0x0025953F]
(No symbol) [0x0023FC26]
(No symbol) [0x0021218C]
(No symbol) [0x0021310D]
GetHandleVerifier [0x006196D3+2800643]
GetHandleVerifier [0x0067428E+3172286]
GetHandleVerifier [0x0066CEA2+3142610]
GetHandleVerifier [0x00416C60+692624]
(No symbol) [0x00304C5D]
(No symbol) [0x00301968]
(No symbol) [0x00301B00]
(No symbol) [0x002F3FB0]
BaseThreadInitThunk [0x76727BA9+25]
RtlInitializeExceptionChain [0x7779C0CB+107]
RtlClearBits [0x7779C04F+191]
traceback=<traceback object at 0x000001B53E874140>←[0m
←[38;5;196m2024-11-05 09:32:03,464 [ERROR] ←[0m
Traceback (most recent call last):
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 40, in main
earned_points = executeBot(currentAccount, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 249, in executeBot
searches.bingSearches()
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\searches.py", line 136, in bingSearches
self.bingSearch()
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\searches.py", line 171, in bingSearch
searchbar = self.browser.utils.waitUntilClickable(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\utils.py", line 81, in waitUntilClickable
return WebDriverWait(self.webdriver, timeToWait).until(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\aless\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\support\wait.py", line 105, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
GetHandleVerifier [0x003738B3+24035]
(No symbol) [0x002FBC44]
(No symbol) [0x001DC2D3]
(No symbol) [0x0021DC86]
(No symbol) [0x0021DECB]
(No symbol) [0x0025B9D2]
(No symbol) [0x0023FED4]
(No symbol) [0x0025953F]
(No symbol) [0x0023FC26]
(No symbol) [0x0021218C]
(No symbol) [0x0021310D]
GetHandleVerifier [0x006196D3+2800643]
GetHandleVerifier [0x0067428E+3172286]
GetHandleVerifier [0x0066CEA2+3142610]
GetHandleVerifier [0x00416C60+692624]
(No symbol) [0x00304C5D]
(No symbol) [0x00301968]
(No symbol) [0x00301B00]
(No symbol) [0x002F3FB0]
BaseThreadInitThunk [0x76727BA9+25]
RtlInitializeExceptionChain [0x7779C0CB+107]
RtlClearBits [0x7779C04F+191]

←[38;5;226m2024-11-05 09:32:03,468 [WARNING] config-private.yaml doesn't exist←[0m
←[38;21m2024-11-05 09:32:03,468 [DEBUG] No urls found, not sending notification←[0m
←[38;5;39m2024-11-05 09:32:03,469 [INFO] [POINTS] Data saved for the next day.←[0m

Screenshots

N/A

Value of dashboard variable

N/A

@iDarkSnow iDarkSnow added the bug Something isn't working label Nov 5, 2024
@cal4
Copy link
Collaborator

cal4 commented Nov 5, 2024

Try develop

@iDarkSnow
Copy link
Author

iDarkSnow commented Nov 5, 2024

I did but I found it confusing, is there a way to check progress during the execution of the script from the develop branch?
I found nothing in the argumentParser function

@cal4
Copy link
Collaborator

cal4 commented Nov 5, 2024

I'm assuming you mean via logging? You can change logging.level in config.yaml to DEBUG from INFO to get more granular logs. Think the default log level changed which explains the confusion.

@iDarkSnow
Copy link
Author

Yes, exactly what I meant. Sorry for my lack of clarity. It seems to be running as expected now, thank you. I will update as soon as the script finishes, hopefully to close the issue :)

@cal4
Copy link
Collaborator

cal4 commented Nov 5, 2024

All good, glad to hear

@iDarkSnow
Copy link
Author

Update: while desktop searches finish without problems, mobile searches are stuck on 20 remaining even though the search terms are changing. Is it a known issue?
The script has been running since 2:23 PM GMT+1

@iDarkSnow
Copy link
Author

After running the scheduled task generated with the dedicated python script, this morning i got an assertion error on PCSearch:
Traceback (most recent call last):
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 39, in main
earned_points = executeBot(currentAccount, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 246, in executeBot
searches.bingSearches()
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\searches.py", line 110, in bingSearches
desktopAndMobileRemaining = self.browser.getRemainingSearches(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\browser.py", line 283, in getRemainingSearches
pcSearch: dict = counters["PCSearch"][0]
~~~~~~~~^^^^^^^^^^^^
KeyError: 'PCSearch'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 347, in
main()
File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 42, in main
sendNotification(
File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\utils.py", line 273, in sendNotification
assert apprise.notify(title=str(title), body=str(body))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

Update: while desktop searches finish without problems, mobile searches are stuck on 20 remaining even though the search terms are changing. Is it a known issue? The script has been running since 2:23 PM GMT+1

Doesn't happen to me

After running the scheduled task generated with the dedicated python script, this morning i got an assertion error on PCSearch: Traceback (most recent call last): File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 39, in main earned_points = executeBot(currentAccount, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 246, in executeBot searches.bingSearches() File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\searches.py", line 110, in bingSearches desktopAndMobileRemaining = self.browser.getRemainingSearches( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\browser.py", line 283, in getRemainingSearches pcSearch: dict = counters["PCSearch"][0] ~~~~~~~~^^^^^^^^^^^^ KeyError: 'PCSearch'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 347, in main() File "C:\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 42, in main sendNotification( File "C:\Microsoft Rewards\MS-Rewards-Farmer\src\utils.py", line 273, in sendNotification assert apprise.notify(title=str(title), body=str(body)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

See #208 (comment). Don't think the scheduled task contributes to this problem.

@iDarkSnow
Copy link
Author

So there is nothing i can do to fix the AssertionError?

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

You mean the KeyError? The AssertionError is occurring because a notification should've been sent, but wasn't able to be sent for some reason.

As far as the KeyError, it's a known-issue. The only workaround I've noticed is that if you just logged-in, it can take a little bit for this call to work correctly.

@iDarkSnow
Copy link
Author

Yes sorry, i guess the AssertionError comes as a consequence of the KeyError. I get the KeyError as soon as researches start after daily tasks now, i also cleared my sessions folder but the issue persist. Could you explain the workaround a little further? I didn't quite understand your solution, sorry

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

Basically spam the runs after logging in. It takes a bit for the cookies/auth to be in place so that you can access the remaining searches.

And just to be clear, the AssertionError isn't a consequence of the KeyError. If you've configured your bot to send notifications on failures, it can't do that currently most likely due to your config. Basically it's saying the bot tried to send a notification, but it wasn't successfully sent. Since we expect this to work at this point in the program, the assertion fails and throws an exception.

@iDarkSnow
Copy link
Author

iDarkSnow commented Nov 6, 2024

I did not configure the bot to send any notifications, i didn't find anything in the project readme, but i understand now the two errors are not linked. And is it also default behaviour that when this sequence of errors happens the script stops and i get returned to the command line? Shouldn't it move to the next account/research type (e.g. from desktop to mobile searches)?

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

It should work that way in regards to accounts, see

for currentAccount in loadedAccounts:
try:
earned_points = executeBot(currentAccount, args)
except Exception as e1:
logging.error("", exc_info=True)
sendNotification(
f"⚠️ Error executing {currentAccount.username}, please check the log",
traceback.format_exc(),
e1,
)
continue

As far as attempting mobile if desktop fails, I'm pretty confident that if you can't get the remaining searches (or access account info more generally) for one you can't for the other. Try commenting out code or just running mobile searches to see.

In regards to notifications, do you have a config-private.yaml file?

@iDarkSnow
Copy link
Author

iDarkSnow commented Nov 6, 2024

I do have a config-private.yaml file in my directory, though it is configured as follows, so probably serves nothing as i haven't added any additional configurations:

# Copy this file to config-private.yaml to use
apprise:
  urls:
    - 'discord://WebhookID/WebhookToken'  # Replace with your actual Apprise service URLs

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

Yeah, since you have an entry under urls the bot will try to send a notification. It can't really figure whether the url is legit or not, and obviously this one'll fail because there's no token.

I'd recommend getting rid of config-private.yaml if you don't plan to use it or get rid of the urls entry.

@iDarkSnow
Copy link
Author

Yes, that did the trick for the AssertionError. I only get stuck on the KeyError now, even though for some reason my output doesn't contain DEBUG level info anymore?

@cal4
Copy link
Collaborator

cal4 commented Nov 6, 2024

Not happening for me, double check the config and pull the latest from develop

@perhorst1234
Copy link

Hi, I have the same issue but when i try the develop branch the output was this -bash: syntax error near unexpected token `('

@iDarkSnow
Copy link
Author

Not happening for me, double check the config and pull the latest from develop

I deleted the whole repo and cloned it back again, removed the config-private file and edited the config file to use DEBUG level logging, same thing happens where i don't get logging in the output of the script. Any idea what might cause this issue?

@iDarkSnow
Copy link
Author

iDarkSnow commented Nov 7, 2024

I confirm that the DEBUG level logging came back as soon as i restored the config-private.yaml file even though it still contains the placeholder link but doing so brought back the PCSearch KeyError. So the current situation is the following:

  • Removing the config-private.yaml file seems to make searches start and removes both the KeyError and AssertionError, but for some reason it stops the correct functioning of the logging of the script;
  • Having the config-private.yaml file seems to break the script by introducing a KeyError.

These things do not seem related to me, do you have any idea of what it might be?

@perhorst1234
Copy link

and I get this error now ERROR:root:
Traceback (most recent call last):
File "/home/MS-Rewards-Farmer-develop/MS-Rewards-Farmer-develop/main.py", line 39, in main
earned_points = executeBot(currentAccount, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/MS-Rewards-Farmer-develop/MS-Rewards-Farmer-develop/main.py", line 234, in executeBot
with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/MS-Rewards-Farmer-develop/MS-Rewards-Farmer-develop/src/browser.py", line 41, in init
self.localeLang, self.localeGeo = self.getLanguageCountry(args.lang, args.geo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/MS-Rewards-Farmer-develop/MS-Rewards-Farmer-develop/src/browser.py", line 234, in getLanguageCountry
).alpha_2
^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pycountry/db.py", line 16, in getattr
raise AttributeError(key)
AttributeError: alpha_2

@TheBrokenG0d
Copy link

I confirm that the DEBUG level logging came back as soon as i restored the config-private.yaml file even though it still contains the placeholder link but doing so brought back the PCSearch KeyError. So the current situation is the following:

  • Removing the config-private.yaml file seems to make searches start and removes both the KeyError and AssertionError, but for some reason it stops the correct functioning of the logging of the script;
  • Having the config-private.yaml file seems to break the script by introducing a KeyError.

These things do not seem related to me, do you have any idea of what it might be?

I can confirm this too, If I don't have a config-private.yaml the debug doesn't work.
Starting with a fresh dev branch install I had to rename the private-config template file for the debug logging to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants