title: Launching python script with cron job
body: <p>I was recently trying to use cron job for my python script on my mac but it is not working properly. I have following simple script for scraping gold price which mark price and time into csv.</p>
  <pre><code>import csv
  import requests
  import bs4
  from datetime import datetime as dt
  import os
  
  # task is to scrape gold price and time from https://markets.businessinsider.com/commodities/gold-price and save it in csv
  def get_gold_price():
      page = requests.get(&quot;https://markets.businessinsider.com/commodities/gold-price&quot;)
      soup = bs4.BeautifulSoup(page.text, &quot;html.parser&quot;)
      price = soup.find(&quot;span&quot;, {&quot;class&quot;:&quot;price-section__current-value&quot;}).text
      print('The current price is {} USD'.format(price))
      return price
  
  def write_to_csv(price):
      DATE_FORMAT = '%d.%m.%Y %H:%M'
      if &quot;gold_price.csv&quot; in os.listdir():
          mode = &quot;a&quot;
      else:
          mode = &quot;w&quot;
      f = open(&quot;gold_price.csv&quot;, mode)
      f_writer = csv.writer(f)
      f_writer.writerow([price,dt.now().strftime(DATE_FORMAT)])
      f.close()
  print(write_to_csv(get_gold_price()))
  </code></pre>
  <p>When I run the script in Pycharm, it is working fine. When I put in my crontab in terminal it is not marking the price every minute.</p>
  <pre><code>* * * * * /Users/petrsevcik/PycharmProjects/New_Scraping_Project/bin/python /Users/petrsevcik/PycharmProjects/scraping_gold_price/Scraping_Gold_Price.py
  </code></pre>
  <p>Any advise please? Is the problem in cron or my script?</p>