I'm trying to schedule a section of my flask code daily (it sends me an email with the weather) and when I run it normally it's fine but when scheduled it gives an error. The scheduled code:
import sys
sys.path.insert(0, '/home/JackGrimm/mysite')
import flask_app as importfile
def main():
importfile.sendweather()
main()
The error:
File "/home/JackGrimm/mysite/flask_app.py", line 4, in <module>
from urllib.request import urlopen
ImportError: No module named request
That section of code is used for another function, so is there a simple fix other than splitting up my code? It's only giving an error when I schedule it.