#๐Ÿ”’ need some help in this code

56 messages ยท Page 1 of 1 (latest)

modern swift
violet vesselBOT
#

@modern swift

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.

modern swift
#

one is flask the other is for the bluetooth app

#

so just to explain im making an app that uses ble beacon for uni when you go to class you can regiseter the class with your id and name and if you get out of range you will be signed out

little pendant
#

Did I help you on Reddit like yesterday?

modern swift
#

nope

#

i dont be on reddit

little pendant
#

That's funny. I just helped someone who was doing basically this.

modern swift
#

really ?

#

wow

#

but can u help me with it ?

little pendant
#

Well, their question was a lot more general, but maybe.

modern swift
#

i would really appreciate it

#

u can take a look at the code from the links

little pendant
#

Yes, what's the question?

modern swift
#

its the first time doing this

rain merlin
#

whasty the error

#

is there an error sir

modern swift
#

whenever i try to run it i get the error of flask not found even though its donwloaded

rain merlin
#

Then your good

#

download flask again

#

simple

modern swift
#

i did it

rain merlin
#

redownload it

modern swift
#

it says already satisfied

rain merlin
#

download a depracated version

modern swift
#

how

rain merlin
#

or just import pip

modern swift
#

how can i do it ?

rain merlin
#
import subprocess
import sys

def install(package):
    subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])

# Example usage
install('requests')

#

it wasnt improt pip

modern swift
#

let me try it

rain merlin
#

copy the code before the comment

modern swift
#

gives me an error still

rain merlin
#
import subprocess
import sys

def install(package):
    subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])

# Example usage
install('flask')

include in the program

#

it works on my system /shrug

modern swift
#

lemme try it

#

sorry im new to all this

little pendant
#

If you have a virtual environment, you need to activate it before running pip.

modern swift
#

thats why im a bit slow

little pendant
#

Do you have a venv directory in your project folder?

modern swift
#

no

little pendant
#

What does pip list show?

modern swift
little pendant
#

How are you running the code when you get the error? And what is the exact error?

modern swift
#

hold on

#

gonna run it right now and show u

#

@little pendant

little pendant
#

I think VSCode is just using a different version of Python than the one you have in your PATH.

#

I'd just set up a virtual environment. That will make it easier to control what packages you use. If you install into a global installation, that may comflict with other projects, so installing into and using the global install for projects isn't a good idea.

violet vesselBOT
#
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.