charlesbel / Microsoft-Rewards-Farmer

A simple bot that uses selenium to farm Microsoft Rewards written in Python
MIT License
1.02k stars 274 forks source link

[BUG] ImportError: cannot import name 'Headers' from 'h11._headers' #268

Closed kaorlol closed 1 year ago

kaorlol commented 1 year ago

Before submitting a bug report...

Describe the bug

errors on run

Copy and paste your error

Traceback (most recent call last): File "C:\Users\jacob\Downloads\Microsoft-Rewards-Farmer-master\main.py", line 9, in from src import Browser, DailySet, Login, MorePromotions, PunchCards, Searches File "C:\Users\jacob\Downloads\Microsoft-Rewards-Farmer-master\src__init.py", line 1, in from .browser import Browser File "C:\Users\jacob\Downloads\Microsoft-Rewards-Farmer-master\src\browser.py", line 9, in import seleniumwire.undetected_chromedriver as webdriver File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\undetected_chromedriver__init__.py", line 1, in from .webdriver import Chrome, ChromeOptions File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\undetected_chromedriver\webdriver.py", line 14, in from seleniumwire.webdriver import DriverCommonMixin File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\webdriver.py", line 28, in from seleniumwire import backend, utils File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\backend.py", line 4, in from seleniumwire.server import MitmProxy File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\server.py", line 7, in from seleniumwire.thirdparty.mitmproxy import addons File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\addons__init__.py", line 1, in from seleniumwire.thirdparty.mitmproxy.addons import core File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\addons\core.py", line 5, in from seleniumwire.thirdparty.mitmproxy import command, ctx, exceptions, optmanager, platform File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\ctx.py", line 2, in import seleniumwire.thirdparty.mitmproxy.master File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\master.py", line 7, in from seleniumwire.thirdparty.mitmproxy import ( File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\addonmanager.py", line 8, in from seleniumwire.thirdparty.mitmproxy import controller, eventsequence, exceptions File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\eventsequence.py", line 3, in from seleniumwire.thirdparty.mitmproxy import controller, http, tcp, websocket File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\seleniumwire\thirdparty\mitmproxy\websocket.py", line 5, in from wsproto.frame_protocol import CloseReason, Opcode File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\wsproto\init__.py", line 9, in from .connection import Connection, ConnectionState, ConnectionType File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\wsproto\connection.py", line 23, in from .utilities import LocalProtocolError File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\wsproto\utilities.py", line 12, in from h11._headers import Headers as H11Headers ImportError: cannot import name 'Headers' from 'h11._headers' (C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\h11_headers.py)

Screenshots

image

Value of dashboard variable

https://gist.github.com/Uvxtq/01ff3289d8f49b2aaf93d191d9f62118

charlesbel commented 1 year ago

Please run pip install -r requirements.txt --upgrade in the project folder to make sure every dependencie is up to date

kaorlol commented 1 year ago

image

charlesbel commented 1 year ago

image

You seems to have issues with your installation of pip. Try again with command prompt ran as admin.

kaorlol commented 1 year ago

Okay after running the command in and admin terminal it upgrades everything and when I run main.py it still crashes and gives the same error.

charlesbel commented 1 year ago

Okay after running the command in and admin terminal it upgrades everything and when I run main.py it still crashes and gives the same error.

Try reinstalling h11 with

pip uninstall h11
pip install h11

If you also get "Access denied" error, do it as admin.

kaorlol commented 1 year ago

image

charlesbel commented 1 year ago

image

What does your accounts.json looks like ? Because this error means it's malformed.

charlesbel commented 1 year ago

Considering resolved with correct file format for accounts.json