135201
You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
I want to ask about does it worth to learn python in this ai situation? I mean can I even make 1$ or ai wont let me
Читать полностью…
sorry sorry i didn't remember this, actually i thought he is from my own bengali language person that' why btw i will be very careful next time 😅
thanks i will try to help others directly in the chat group from now
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase.
It seems you are learning Python in Bengali from an AI. If you need help with Python in Bengali, please feel free to message me privately with more explanation and context.
Читать полностью…
you can type hint it as dict[str, str] in the function signature
So no.
It is about type hinting, you need to put the type of data you expect if you want to comply with type hints if not just skip the line with # type: ignore
yaa its like saying data will be anything str, int, float or anthing thats why it say the problem will occurs
Читать полностью…
See i was handling taking reqest by the fetch in the js to my Flask application, see what happens i write my fun like this,
@general_bp.route("/api/backend/save-song-info", methods=["POST"])
def save_song_info():
data = request.get_json() or {}
# Extract the fields sent from js fetch
song_id = data.get("id")
title = data.get("title")
image_url = data.get("image_url")
artist = data.get("artist")
Type of "data" is partially unknown
Type of "data" is "Any | dict[Unknown, Unknown]"PylancereportUnknownVariableType
"Hi", "hello" and all other socializing goes to @pythonofftopic! Feel free to chat there, and ask for help with Python code here. Don't forget to delete your message from this group!
Читать полностью…
And file automation.. is obviously not only about file operation, that's too general, what are you going to process?
Читать полностью…
That's different topics and unlikely being placed in a single course
Читать полностью…
But when I see jev or fable 5.1 they can replace us
Читать полностью…
yaa i think i should to convert this dict[Any,Any] to this payload first in a try-except block and then use this will be fully ok as i can think
Читать полностью…
usually you pass reply_to_message_id=message.message_id in bot.send_message()
"dict[Any, Any]" is not assignable to "SongPayload"
Why isn't 'reply to message id' working here? 🤨
def send_join_channel_message(chat_id_or_message):Читать полностью…
markup = types.InlineKeyboardMarkup()
join_button = types.InlineKeyboardButton(
"Join Our Channel", url=CHANNEL_URL, style="primary"
)
markup.add(join_button)
# ৪টি প্রিমিয়াম ইমোজি সহ সাজানো টেক্সট
text = (
'<tg-emoji emoji-id="5472279086657199080">🤖</tg-emoji> Welcome To Our'
" Bot!\n\n"
'<tg-emoji emoji-id="5274099962655816924">⚠️</tg-emoji> Mandatory Notice:\n'
"To use this bot, you must join our official channel first.\n\n"
'<tg-emoji emoji-id="5875335525136602241">🔗</tg-emoji> Channel Link :'
f" {CHANNEL_URL}\n\n"
'<tg-emoji emoji-id="5298671298757538191">✅</tg-emoji> Once you have'
" joined, please send /start again to begin!"
)
try:
# যদি পুরো message অবজেক্ট পাস করা হয়, তবে ১০০% নিশ্চিতভাবে রিপ্লাই সহ কাজ করবে
if hasattr(chat_id_or_message, "chat") and hasattr(
chat_id_or_message, "message_id"
):
bot.send_message(
chat_id_or_message.chat.id,
text,
reply_markup=markup,
parse_mode="HTML",
reply_to_message_id=chat_id_or_message.message_id,
)
else:
# যদি শুধু chat_id (int) পাস করা হয়, তবে সাধারণ মেসেজ পাঠিয়ে দেবে (ক্র্যাশ করবে না)
bot.send_message(
chat_id_or_message, text, reply_markup=markup, parse_mode="HTML"
)
except Exception as e:
logging.error(f"Error sending join message: {e}")
See One Things just adding data:dict[str,str] works fines, but before when i take sugession from ai chat, they say to use like this, what do you say using like below will better or not,
from typing import TypedDict, Optional
# 1. Define the structure of what your JS fetch sends
class SongPayload(TypedDict):
id: str
title: str
image_url: str
artist: str
@general_bp.route("/api/backend/save-song-info", methods=["POST"])
def save_song_info():
# 2. Tell Pylance this json data matches your SongPayload structure
data: SongPayload = request.get_json() or {}
# 3. Now when you type data.get("..."), your IDE will auto-suggest
song_id = data.get("id")
title = data.get("title")
image_url = data.get("image_url")
artist = data.get("artist")
Type "Any | dict[Any, Any]" is not assignable to declared type "SongPayload"
Type "Any | dict[Any, Any]" is not assignable to type "SongPayload"
"dict[Any, Any]" is not assignable to "SongPayload"PylancereportAssignmentType
data :dict[str,str] = request.get_json() or {} # type: ignore
Yaa just it solved this thanks🙏
# type: ignore
i tried this, but as a result but all the other key _value that is song_id, title,image_url, artist all going to say type hint issue of unknown 😅
mabye thats why data says unknown, but i want to solve this that it will be dict[str,str]
Читать полностью…
Do you understand pylance errors? i mean the puprose of it
Читать полностью…
thought maybe u say i need to use regex inside the .routes()?
owo but i discovered something inside the fun i checked if the video_id starts with https then treat it as a valid else say user this is wrong format 💜
but now i think using regex would be better but not a easy choice 😅
To make your life easier, try xlwings or simply write scripts to execute inside the Microsoft Office, if you'd sure your user have the latest Microsoft 365 installed
Читать полностью…
I meant Python Software Automation for instance file automation ,excel automation , API automation and more.....
Читать полностью…