1

I am trying to deploy this bot on the local machine. But I have got irritated by an error. main.py

import logging

from .utubebot import UtubeBot
from .config import Config


if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG if Config.DEBUG else logging.INFO)
    logging.getLogger("pyrogram").setLevel(
        logging.INFO if Config.DEBUG else logging.WARNING
    )

    UtubeBot().run()

utube.py

from pyrogram import Client

from .config import Config


class Utubebot(Client):
    def __init__(self,  **kwargs):
        super().__init__(
            session_name=Config.SESSION_NAME,
            bot_token=Config.BOT_TOKEN,
            api_id=Config.API_ID,
            api_hash=Config.API_HASH,
            plugins=dict(root="bot.plugins"),
            workers=100,
        )
        self.DOWNLOAD_WORKERS = 100
        self.counter = 0
        self.download_controller = {}

config.py

import os


class Config:

    BOT_TOKEN = os.environ.get("BOT_TOKEN")

    SESSION_NAME = os.environ.get("SESSION_NAME", "utubeitbot")

    API_ID = os.environ.get("API_ID")

    API_HASH = os.environ.get("API_HASH")

    CLIENT_ID = os.environ.get("CLIENT_ID")

    CLIENT_SECRET = os.environ.get("CLIENT_SECRET")

    BOT_OWNER = os.environ.get("BOT_OWNER")

    AUTH_USERS_TEXT = os.environ.get("AUTH_USERS", "")

    AUTH_USERS = [BOT_OWNER, 754495556] + (
        [int(user.strip()) for user in AUTH_USERS_TEXT.split(",")]
        if AUTH_USERS_TEXT
        else []
    )

    VIDEO_DESCRIPTION = (
        os.environ.get("VIDEO_DESCRIPTION", "").replace("<", "").replace(">", "")
    )

    VIDEO_CATEGORY = (
        int(os.environ.get("VIDEO_CATEGORY")) if os.environ.get("VIDEO_CATEGORY") else 0
    )

    VIDEO_TITLE_PREFIX = os.environ.get("VIDEO_TITLE_PREFIX", "")

    VIDEO_TITLE_SUFFIX = os.environ.get("VIDEO_TITLE_SUFFIX", "")

    DEBUG = bool(os.environ.get("DEBUG"))

    UPLOAD_MODE = os.environ.get("UPLOAD_MODE") or False
    if UPLOAD_MODE:
        if UPLOAD_MODE.lower() in ["private", "public", "unlisted"]:
            UPLOAD_MODE = UPLOAD_MODE.lower()
        else:
            UPLOAD_MODE = False

    CRED_FILE = "auth_token.txt"

the error is:-

PS E:\lotus2> py -m bot
Traceback (most recent call last):
  File "C:\Users\ankit\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\ankit\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\lotus2\bot\__main__.py", line 13, in <module>
    UtubeBot().run()
  File "E:\lotus2\bot\utubebot.py", line 8, in __init__
    super().__init__(
  File "C:\Users\ankit\AppData\Local\Programs\Python\Python310\lib\site-packages\pyrogram\client.py", line 242, in __init__
    else:            raise ValueError("Unknown storage engine")
ValueError: Unknown storage engine

This is a simple hobby project which I was really curious about to implement. This is a Telegram bot which uses Youtube Data API v3 to upload videos to Youtube. Libraries Used Pyrogram Google Client API it is a youtube remotely uploader bot for telegram. I can't understand what is the error can someone crack it?

Ankit
  • 123
  • 9
  • by https://github.com/pyrogram/pyrogram/blob/v1.2.0/pyrogram/client.py#L243. You should check the `Config.SESSION_NAME`'s type.Be `str` or `Storage` – lanhao945 Sep 07 '22 at 06:16
  • I can't understand your statement, but i am adding my config.py. check it for possible error. – Ankit Sep 08 '22 at 12:30

1 Answers1

1

Try this from

SESSION_NAME = os.environ.get("SESSION_NAME", "utubeit")

to

SESSION_NAME = os.environ.get("SESSION_NAME", ":lethagric")

the name is according to your project. if lethagric doesn't work try memory it can solve your problem of unknow source engine. Keep coding!

  • Yep it worked i have found it one hour before, there is new problem called File "C:\Users\ankit\AppData\Local\Programs\Python\Python310\lib\os.py", line 742, in check_str raise TypeError("str expected, not %s" % type(value).__name__) TypeError: str expected, not tuple – Ankit Sep 08 '22 at 14:05