TikTok-Api icon indicating copy to clipboard operation
TikTok-Api copied to clipboard

AttributeError: 'TikTokApi' object has no attribute '_browser'

Open sudo-paoo opened this issue 1 year ago • 6 comments

heroku logs showing AttributeError: 'TikTokApi' object has no attribute '_browser' i have playwright, puppeteer buildpack on heroku

2022-07-28T07:13:11.018984+00:00 app[bot.1]: Traceback (most recent call last): 2022-07-28T07:13:11.018985+00:00 app[bot.1]: File "/app/.heroku/python/lib/python3.10/site-packages/TikTokApi/tiktok.py", line 421, in del 2022-07-28T07:13:11.019011+00:00 app[bot.1]: File "/app/.heroku/python/lib/python3.10/site-packages/TikTokApi/tiktok.py", line 635, in shutdown 2022-07-28T07:13:11.019061+00:00 app[bot.1]: AttributeError: 'TikTokApi' object has no attribute '_browser' 2022-07-28T07:13:11.244049+00:00 heroku[bot.1]: State changed from up to crashed

sudo-paoo avatar Jul 28 '22 07:07 sudo-paoo

figured out what is the cause but i didnt know why,, if i run this code from vs code it works

#working on vscode // doesnt work on heroku
from TikTokApi import TikTokApi

api = TikTokApi()

however the code above doesnt work on heroku so i did this instead of using a variable to call TikTokApi i just use TikTokApi

#works perfectly
TikTokApi.video(url=url).info()

sudo-paoo avatar Jul 28 '22 09:07 sudo-paoo

mb it doesnt work on heroku,, other cmds are working however the TikTokApi have some error saying that

'TikTokApi' object has no attribute '_browser'

sudo-paoo avatar Jul 29 '22 02:07 sudo-paoo

mb it doesnt work on heroku,, other cmds are working however the TikTokApi have some error saying that

'TikTokApi' object has no attribute '_browser'

is there a way to fix this? image

sudo-paoo avatar Jul 29 '22 02:07 sudo-paoo

Try python3 -m playwright install, maybe this gonna help you.

mrksbgg avatar Jul 29 '22 06:07 mrksbgg

Try python3 -m playwright install, maybe this gonna help you.

i already tried that :(

here are the things i've tried

  • added pytest-playwright on the requirements.txt
  • run pip install pytest-playwright in the vs code
  • run pip install pytest-playwright in the heroku console
  • run playwright install in vs code
  • run playwright install in heroku console

sudo-paoo avatar Jul 29 '22 07:07 sudo-paoo

Having the same issue :(

lirankor avatar Sep 04 '22 11:09 lirankor

Add the following snippet import nest_asyncio nest_asyncio.apply() prior to instantiate your API object.

Reference is from here: https://stackoverflow.com/questions/46827007/runtimeerror-this-event-loop-is-already-running-in-python

robertmoga avatar Oct 11 '22 18:10 robertmoga

What fixed this for me was uninstalling and re-installing playwright with pip, and then running

playwright install

again

feelixs avatar Dec 03 '22 20:12 feelixs

ok Saturday, 03 December 2022, 11:09PM +03:00 from Michael Miele-Herndon @.*** :

What fixed this for me was uninstalling and re-installing playwright with pip, and then running

playwright install again — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you commented. Message ID: @ github . com>

mrksbgg avatar Dec 03 '22 20:12 mrksbgg

should be fixed in V6

davidteather avatar Aug 08 '23 22:08 davidteather

having this issue now, have tried everything in this thread with no fix. Not sure if it is because I am running the code from within a docker container

alfonsov2678 avatar Oct 02 '23 04:10 alfonsov2678