davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.88k stars 976 forks source link

[Errno 12] Cannot Allocate Memory #212

Closed hamedwaezi01-zz closed 4 years ago

hamedwaezi01-zz commented 4 years ago

Hi. I wanted to get trending tiktok videos on a shared python host. but it couldn't because of memory allocation problem. As soon as it starts the program I get the error.I wanted to know how to handle it.

from TikTokApi import TikTokApi
apt = TikTokApi()
.
.
.
whlie trendings >0:

    tr = api.trending(count=trendings, proxy=None)
   .
   .
   .

some parts of the code were not important. I am just running the above code in a loop.

Traceback (most recent call last):
  File "tik.py", line 87, in <module>
    update_trends(trendings=trendings, con=con, cur=cur)
  File "tik.py", line 25, in update_trends
    tr = api.trending(count=trendings, proxy=None)
  File "~/venv/3.7/lib/python3.7/site-packages/TikTokApi/tiktok.py", line 89, in trending
    b = browser(api_url, language=language, proxy=proxy)
  File "~/venv/3.7/lib/python3.7/site-packages/TikTokApi/browser.py", line 57, in __init__
    loop.run_until_complete(self.start())
  File "/opt/alt/python37/lib64/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "~/venv/3.7/lib/python3.7/site-packages/TikTokApi/browser.py", line 60, in start
    self.browser = await pyppeteer.launch(self.options)
  File "~/venv/3.7/lib/python3.7/site-packages/pyppeteer/launcher.py", line 305, in launch
    return await Launcher(options, **kwargs).launch()
  File "~/venv/3.7/lib/python3.7/site-packages/pyppeteer/launcher.py", line 147, in launch
    self.cmd, **options, )
  File "/opt/alt/python37/lib64/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/opt/alt/python37/lib64/python3.7/subprocess.py", line 1453, in _execute_child
    restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory

Desktop (please complete the following information):

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.79. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

davidteather commented 4 years ago

This error most likely means you do not have enough memory on your server. I run it on servers with 512gb of memory on linux without this error.

davidteather commented 4 years ago

Closing due to lack of activity