title: Executing python3 file with a cron job.
body: <p>I have a python3 script located in /home/valence/ that gets the weather forecast for the current day (max and min temperature values in Celsius) from Yahoo! weather API. The file looks exactly like this:</p>
  
  <pre><code>#!/usr/bin/python3
  from urllib import request
  import json
  url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D349859%20and%20u='c'&amp;format=json&amp;diagnostics=true&amp;callback="
  response=request.urlopen(url)
  str_response = response.readall().decode('utf-8')
  dic = json.loads(str_response)
  dic["query"]["results"]["channel"]["location"]["region"]="R.M."
  low=dic["query"]["results"]["channel"]["item"]["forecast"][0]["low"]
  high=dic["query"]["results"]["channel"]["item"]["forecast"][0]["high"]
  forecast=open("forecast.txt", "w+")
  forecast.write("Minima: "+str(low)+" Maxima: "+str(high))
  forecast.close()
  </code></pre>
  
  <p>It works fine when I execute it. It creates or overwrites the file forecast.txt with the right values, but when I try to use cron to execute with the following cron job:</p>
  
  <pre><code>* * * * * /home/valence/Get_forecast.py
  </code></pre>
  
  <p>no file forecast.txt is created or modified.</p>
  
  <p>So I need to know what I am doing wrong and how to make this work as intended. The cron job is not meant to be executed every minute (because forecast for a day remains the same throughout the day), but for now I have it that way so I can see changes without having to wait much.</p>
  
  <p>Note: I am new to linux (I am using Lubuntu) </p>