Hi Glitch Community,
I am a Python newb and an even bigger Glitch newb. Recently, I made a program using PyCharm that takes an Excel FIle(.xls or .xlsx), converts it into a CSV File, and then email that CSV File using the Yagmail library in conjunction with a SMTP server. I am now trying to bring this project to Glitch with a Flask framework. My issue is that I am getting an error when I am using “pip install Yagmail” in the glitch console. As a result, I am not able to use Yagmail in my program. Does anyone know a way to overcome this problem or has any overall suggestions?
Thanks,
Aryan Kini
Try this instead:
# Python 3
pip3 install --user Yagmail
# Python 2
pip install --user Yagmail
Pip by default attempts to run in the global context which requires sudo permissions (which you don’t have in the Glitch container). The --user
flag causes pip to only install the module to the current user’s Python distribution.
Hi @FlantasticDan,
Thank you for all the help that you have given me so much on this project! I tried what you said and this is what appeared in my console
Any thoughts on how to fix this problem?
Thanks,
Aryan Kini
Glitch doesn’t let me put two images in one post, so here is the second one
Would you mind sharing the name or a link to your project so I can take a look?
Hi @FlantasticDan,
Yeah sure, here it is…https://glitch.com/edit/#!/moc721. It is currently still in development and I have not finished it.
Thanks,
Aryan Kini
I remixed your project and was able to resolve the error by changing the following in your start.sh
file:
# from
python server.py
# to
python3 server.py
It seems Yagmail would only install with Python 3+ so doing this changes your project from the default (and technically unsupported and end of life-ed) Python 2.7 to the more recent Python 3.7.7.
Side note, thank you Glitch for updating to Python 3.7, I don’t know when you did that but I just noticed!
Hi @FlantasticDan,
Thank you for that fix! It worked in my code and now I am able to send the email. I have another issue :(. I want to send an attachment with the email. I am currently using an input set to file to retrieve the file from the user. How would I get the file path from this?
Thanks,
Aryan Kini