#๐Ÿ”’ Help me

47 messages ยท Page 1 of 1 (latest)

mental agateBOT
#

@outer oak

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

wise kernel
#

come on elaborate problem statement

outer oak
#

My msg got deleted

#

I was making Jarvis and idk why my Jarvis is acting strange whenever I don't give any command to it it automatically opens the video of a creepy nun in YouTube and the fact that I have commented the function to open the YouTube page

wise kernel
#

then you should give that code also!

median falcon
mental agateBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

outer oak
#

i pasted

#

now?

ancient copper
median falcon
#

!pypi pyttsx3

mental agateBOT
#

Text to Speech (TTS) library for Python 2 and 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak.

Released on <t:1594057633:D>.

ancient copper
#

Idk about a creepy nun, but this:

elif "youtube" or "play" or "open" in query:

Will not work as you expect.

median falcon
#

!pypi pywhatkit

mental agateBOT
#

PyWhatKit is a Simple and Powerful WhatsApp Automation Library with many useful Features

Released on <t:1656335546:D>.

ancient copper
#

That will always be true. You need a separate in query for each option.

median falcon
#

!pypi wikipedia

mental agateBOT
outer oak
#

Wiat

#

I have demo of the creepy nun

median falcon
#

That one seems unlikely to work.

outer oak
#

I swear to god I'm not faking it

median falcon
#

The commented out code is probably being run, which means there's another copy they're executing

outer oak
frozen stump
#

๐Ÿ’€

#

its googling "None"

#

that should help u guys

ancient copper
outer oak
#

If I say play Weekend or YouTube weekend it opens the video

outer oak
#

How's that working

median falcon
ancient copper
#

If you say anything that wasn't caught in the previous ifs it will open a video. elif "youtube" or "play" or "open" in query: will stop executing at elif "youtube", and will always be true. That condition is effectively elif True:.

outer oak
#

What could be the solution?

outer oak
ancient copper
#

!or

mental agateBOT
#
The or-gotcha

When checking if something is equal to one thing or another, you might think that this is possible:

# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
ancient copper
#

So much so that we have a command for it.

#

Although this is slightly different.

tender trellis
# outer oak So this is the reason for this creepy nun ?

basically your condition is same as if you would just write elif "youtube":, which uhh, is always True, and therefore that elif always works
you must put full conditions in-between or operators in your code: if "this" in something or "that" in something:

mental agateBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.