Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INSTALLATION] - TypeError: 'type' object is not subscriptable #1102

Open
kulig1985 opened this issue Jan 5, 2024 · 4 comments
Open

[INSTALLATION] - TypeError: 'type' object is not subscriptable #1102

kulig1985 opened this issue Jan 5, 2024 · 4 comments
Labels
installation_help Someone is having problems installing the api

Comments

@kulig1985
Copy link

Try to run the docker command with the original trending example and got this error:

Traceback (most recent call last):
File "/TikTokApi/trending_example.py", line 1, in
from TikTokApi import TikTokApi
File "/usr/local/lib/python3.8/dist-packages/TikTokApi/init.py", line 1, in
from TikTokApi.tiktok import TikTokApi
File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 41, in
class TikTokApi:
File "/usr/local/lib/python3.8/dist-packages/TikTokApi/tiktok.py", line 197, in TikTokApi
ms_tokens: list[str] = None,
TypeError: 'type' object is not subscriptable

this is the docker command i run:

docker run -v /host_path_to_api/examples:/TikTokApi -e ms_token=my_ms_token --rm tiktokapi:latest python3 /TikTokApi/trending_example.py

@kulig1985 kulig1985 added the installation_help Someone is having problems installing the api label Jan 5, 2024
@Vinlow
Copy link

Vinlow commented Jan 9, 2024

+1

@ChocoTonic
Copy link

ChocoTonic commented Jan 20, 2024

you need to be 3.9 minimum because of type hint checks. odd the dockerfile doesn't specify this

@fabgrd
Copy link

fabgrd commented Feb 29, 2024

Same issue, my version is 3.12 and I tried everything..

@belaboe97
Copy link

Answer of @ChocoTonic worked for me!

Tested locally with trending_example. I just changed the Dockerfile to:

FROM mcr.microsoft.com/playwright:focal
FROM python:3.10-slim

RUN apt-get update && apt-get install -y python3-pip


COPY . .
RUN pip3 install TikTokApi
RUN python3 -m playwright install
RUN playwright install-deps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
installation_help Someone is having problems installing the api
Projects
None yet
Development

No branches or pull requests

5 participants