Closed iDarkSnow closed 4 months ago
This is happening because the code assumes that the current working directory is the root of the project, where config.yaml exists. If main.py is called from somewhere other than the root of the project, you'll get this error. To confirm for yourself, try executing from a terminal one directory above/below.
So, short term fix is to cd your script to the project dir before running.
Long term fix is to get the config.yaml's absolute path, like this. (I'm planning on merging this stuff after I've run it a few days).
I did figure it was a path problem and i did try the short term fix already but i still had the same problem.
Now, i tried to copy your utils.py file but i get this:
Traceback (most recent call last):
File "---\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 16, in
An additional info i forgot. This script was working for a lot of time before some pull i did not so long ago
It's best to checkout the whole repo. That code depends on other changes which is why you're getting a typeerror.
For now i fixed it by putting the absolute path of my config.yaml file in the utils.py script, we can close if there is no other solution to this atm
As @cal4 said in his comment - other changes were also made so it's best to grab all updated files to make sure you are on the most recent version for all changes. Since you have it working with your method I will close this and if a PR request is made for changes we can review and go from there.
Before submitting a bug report...
Title
Describe the bug
I have a simple .bat file that does the following:
taskkill /pid chrome.exe /t /f taskkill /pid msedge.exe /t /f
---\AppData\Local\Programs\Python\Python39\python.exe "---\Microsoft Rewards\MS-Rewards-Farmer\main.py" -g IT -l it -v
taskkill /pid chrome.exe /t /f taskkill /pid msedge.exe /t /f
When i execute this script manually from PowerShell it executes without problems.
Copy and paste your error
I created a task in the task scheduler to execute this bat file daily, but when it starts the following happens:
Traceback (most recent call last): File "---\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 316, in
main()
File "---\Microsoft Rewards\MS-Rewards-Farmer\main.py", line 57, in main
Utils.send_notification("⚠️ Error occurred, please check the log", str(e))
File "---\Microsoft Rewards\MS-Rewards-Farmer\src\utils.py", line 38, in send_notification
for url in Utils.load_config(config_file)['apprise']['urls']:
File "---\Microsoft Rewards\MS-Rewards-Farmer\src\utils.py", line 32, in load_config
with open(config_file, 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: 'config.yaml'
Screenshots
Can't provide screenshots as the browser opens and instantly closes
Value of dashboard variable
N/A