Minecraft Hypixel-Api Bin Sniper

Viewed 51

Hello im trying to create a minecraft hypixel skyblock ah sniper bot but im keep running into a traceback -

Traceback (most recent call last):
  File "C:\Users\maksi\OneDrive\Pulpit\testingsniper\testing.py", line 146, in <module>
    main()
  File "C:\Users\maksi\OneDrive\Pulpit\testingsniper\testing.py", line 104, in main
    loop.run_until_complete(future)
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
    return future.result()
  File "C:\Users\maksi\OneDrive\Pulpit\testingsniper\testing.py", line 91, in get_data_asynchronous
    for response in await asyncio.gather(*tasks):
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\maksi\OneDrive\Pulpit\testingsniper\testing.py", line 71, in fetch
    if prices[index][1] > LOWEST_PRICE and prices[index][0]/prices[index][1] < LOWEST_PERCENT_MARGIN and auction['start']+60000 > now:
TypeError: '>' not supported between instances of 'float' and 'str'

This keeps happening to mee and i don't know where to put a float or str function or to even put it there. Here is the line of code that crashes

# if the auction fits in some parameters
if prices[index][1] > LOWEST_PRICE and prices[index][0]/prices[index][1] < LOWEST_PERCENT_MARGIN and auction['start']+60000 > now:
    results.append([auction['uuid'], auction['item_name'], auction['starting_bid'], index])

i really don't know what to do to make it work.

1 Answers

As you can see in the error Log, it tells you that you cant use the '>' operator between a float and a string. As you didn't provide the values of both LOWEST_PRICE and LOWEST_PERCENT_MARGIN, Im guessing they are Strings. Heres how I would rewrite your code:

if prices[index][1] > float(LOWEST_PRICE) and prices[index][0]/prices[index][1] < float(LOWEST_PERCENT_MARGIN) and auction['start']+60000 > now:
    results.append([auction['uuid'], auction['item_name'], auction['starting_bid'], index])

Next time you ask a question here, make sure to specify the values, not just the name of them.

Related