#๐Ÿ”’ Program Feature Help

46 messages ยท Page 1 of 1 (latest)

crude robinBOT
#

@stark wasp

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.

stark wasp
#

uhh

rose fractal
# stark wasp uhh

uhh, hey guys, beginner here, I am working on a raspberry project, I just want to add a small feature, which the program can also email when an unregistered person is detected cos emailing only works if someone registered is detected on my camera, I have tried many times but it does not work..

#

recovered your message

stark wasp
#

why is it deleted

#

sorry

rose fractal
#

did you try and upload a file with it?

stark wasp
#

oh yea

#

my bad

#

did not know its not allowed here srry

rose fractal
#

Np!

stark wasp
#

its a txt file and kinda long so i simply jst uploaded it here

#

il jst type it here then :))

#

whoops

#

`#If someone in your dataset is identified, print their name on the screen
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')

#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully`

#

apparently this whole thing here only send an email just for people who are in the dataset, and I wanna also include those who aren't, any idea how should I modify this thing?

crude robinBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

grand shoal
#

use this template :) It will be syntax-highlighted

stark wasp
#

riight my bad

#
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
                
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully```
#

thanks

grand shoal
#

you also better use "py" to add syntax highlight

#

like this

stark wasp
#

ohh right xD

grand shoal
#
#If someone in your dataset is identified, print their name on the screen
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
                
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully
river fulcrum
stark wasp
#

thanks a lot

river fulcrum
#

๐Ÿ˜Š

stark wasp
#

silly me

grand shoal
stark wasp
#
            #If someone in your dataset is identified, print their name on the screen
            if currentname != name:
                currentname = name
                print(currentname)
                #Take a picture to send in the email
                img_name = "image.jpg"
                cv2.imwrite(img_name, frame)
                print('Taking a picture.')
                
                #Now send me an email to let me know who is at the door
                request = send_message(name)
                print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully```
#

here is the actual

#

and the function for that is

#
#function for setting up emails
def send_message(name):
    return requests.post(
        "https://api.sample.net",
        auth=("api", "911"),
        files = [("attachment", ("image.jpg", open("image.jpg", "rb").read()))],
        data={"from": '[email protected]',
            "to": ["[email protected]"],
            "subject": "You have a visitor",
            "html": "<html>" + name + " is at your door.  </html>"})
grand shoal
stark wasp
#
    # loop over the facial embeddings
    for encoding in encodings:
        # attempt to match each face in the input image to our known
        # encodings
        matches = face_recognition.compare_faces(data["encodings"],
            encoding)
        name = "Unknown" #if face is not recognized, then print Unknown
#

unknown appears when a person on camera is not on the dataset

#
#Initialize 'currentname' to trigger only when a new person is identified.
currentname = "unknown"
#

just found out you got paste bin so heres the entire thing

crude robinBOT
#
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.