amazon-python-bot icon indicating copy to clipboard operation
amazon-python-bot copied to clipboard

Script fails after some hours (Around 6?)

Open dan-esc opened this issue 4 years ago • 1 comments

After some hours the script seems to fail. Not sure if this is on Amazon's end on the scripts. Appreciate your script and work.

This is my error log

File "amazon-bot.py", line 29 in checkAndBuyPS5 ... Aborted (core dumped)

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="add-to-cart-button"]"} (Session info: chrome=88.0.4324.96) (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 5.8.0-40-generic x86_64)

dan-esc avatar Jan 24 '21 23:01 dan-esc

unless its available you always get the unable to locate element error, i doubt its the reason it stops

probably the max recursion depth was reached! The Function checkAndBuyPS5 always calls itself once its completed, and this as long as the item is not available. So it is steady filling the memory and each function is still running.

So the first function call is still open while it starts the next call and so on. In the end there are too many open. This ends once the max recursion depth was reached or your computer slows down and freezes?!? It's not recommended to increase this limit (as you pc might crash)

it would be better to call the function only once and use a loop until it hits something. You can break the loop with the break statement once it bought something (but that might not even be needed if the object is closed with self.driver.close())

Netfreak25 avatar Mar 24 '21 13:03 Netfreak25