driscoll42 / ebayMarketAnalyzer

Scrape all eBay sold listings to determine average/median pricing, plot listings over time with trend lines, and extract to excel
198 stars 26 forks source link

KeyError was raised #1

Closed calebchchan closed 3 years ago

calebchchan commented 3 years ago

ASUS Dark Hero -image -jpeg -img -picture -pic -jpg Traceback (most recent call last):

File "/Users/caleb/opt/anaconda3/envs/Ebayscraper/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2889, in get_loc return self._engine.get_loc(casted_key)

File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc

File "pandas/_libs/index.pyx", line 97, in pandas._libs.index.IndexEngine.get_loc

File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item

File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'Ignore'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/Users/caleb/Desktop/Ebay Scrapper/main.py", line 1074, in df_darkhero = ebay_search('ASUS Dark Hero -image -jpeg -img -picture -pic -jpg', http, 399, 400, 1000,

File "/Users/caleb/Desktop/Ebay Scrapper/main.py", line 618, in ebay_search df = df[df['Ignore'] == 0]

File "/Users/caleb/opt/anaconda3/envs/Ebayscraper/lib/python3.8/site-packages/pandas/core/frame.py", line 2899, in getitem indexer = self.columns.get_loc(key)

File "/Users/caleb/opt/anaconda3/envs/Ebayscraper/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2891, in get_loc raise KeyError(key) from err

KeyError: 'Ignore'

driscoll42 commented 3 years ago

With the current version of the code that I pushed it has run_cached = True, which assumes that an extract already exists but will error out if it does not. I added a warning to suggest changing run_cached=False and for it to fail more gracefully in the latest commit.