[Python] Traceback (most recent call last) error in python

Discussão em 'Python' iniciado por Stack, Junho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm getting this error:

    Traceback (most recent call last):

    File "/opt/render/project/src/bot.py", line 4, in <module> from google import genai as google_genai

    ImportError: cannot import name 'genai' from 'google' (unknown location)


    Here's my code:

    import discord
    from discord import app_commands
    import google.generativeai as genai
    from google import genai as google_genai
    from google.genai.types import Tool, GenerateContentConfig, GoogleSearch
    import os
    import re
    from urllib.parse import urlparse
    from dotenv import load_dotenv
    from flask import Flask
    from threading import Thread
    from datetime import datetime, timedelta
    import PIL.Image
    import io


    I Tried to run it in my local computer, and it works well. But when I try to deploy it, I'm getting that error. How to solve it?

    Continue reading...

Compartilhe esta Página