Closed LaxmanMaharjan closed 3 years ago
Apparently, the .yml workflow is running correctly and the error seems to be in the python code. Have you properly set up the GitHub secrets EMAIL_ADDRESS
and EMAIL_PASSWORD
?
I think I did it properly Took Reference from your blog
On Sun, Apr 25, 2021, 9:59 PM canovasjm @.*** wrote:
Apparently, the .yml workflow is running correctly and the error seems to be in the python code. Have you properly set up the GitHub secrets EMAIL_ADDRESS and EMAIL_PASSWORD ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canovasjm/covid-19-san-juan/issues/1#issuecomment-826349282, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN2DWP4KMWMQJSC3Q6ODLP3TKQ5VRANCNFSM43RBGAMQ .
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) TypeError: can only concatenate str (not "bytes") to str I can't understand why this error appears even though EMAIL_ADDRESS and EMAIL_PASSWORD are both str type
I think there is still an issue with the GitHub secrets, from what I see in the log from your failed run. You can check it as follows:
1) Go to your repo
2) Go to the "Actions" tab
3) Select the failed run
4) Select "build" under jobs
5) Unfold "execute py script"
6) Unfold "Run python send email"
7) Check the secrets' name under env:
The successful log for mi repository looks as follows:
You can see mine has three stars ***
, indicating that something is being read there. This is not the case for your workflow.
Yes Thank you so much There was an issue with the GitHub secrets, was setting secrets in environment instead of repo. Thank you for help means a lot.
I'm glad it helped! :)
This is python file import smtplib import os from email.message import EmailMessage
EMAIL_ADDRESS = os.environ.get('EMAIL_ADDRESS') EMAIL_PASSWORD = os.environ.get('EMAIL_PASSWORD')
msg = EmailMessage() msg['Subject'] = 'Checking smtplib FROM GITHUB' msg['From'] = EMAIL_ADDRESS msg['To'] = 'lxmnmrzn@gmail.com'
msg.set_content('This is a email check.')
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp: smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD) smtp.send_message(msg)
This is .yml file name: CI
on:
push: branches: [ master ] pull_request: branches: [ master ] schedule:
cron: '/5 *'
workflow_dispatch:
jobs:
build:
This error comes while running python file in github actions TypeError: can only concatenate str (not "bytes") to str