title: python script stops at import statement when script is run as cronjob
body: <p>I'm executing a python script every 30 minutes with cron, but it stops at the import statement and I don't understand why because I don't get any feedback.</p>
  
  <p>In my crontab I have <code>*/30 * * * * sh exec_script.sh</code></p>
  
  <p>The file <code>exec_script.sh</code> is</p>
  
  <pre><code>cd /home/ziofil/python_scripts
  python script_30_mins.py
  </code></pre>
  
  <p>In the python script I have </p>
  
  <pre><code>import logging
  logging.basicConfig(filename="explicit_log.txt",level=logging.DEBUG)
  logger = logging.getLogger(__name__)
  
  logger.debug("script is executed")
  
  # in the python_scripts folder there is a subfolder utilities/ that
  # contains utility_1.py, were I define the class Utility
  from utilities.utility_1 import Utility
  logger.debug("Utility loaded")
  
  utility = Utility()
  logger.debug("object creation")
  
  utility.do_your_thing()
  logger.debug("done its thing")
  </code></pre>
  
  <p>If I execute <code>python script_30_minutes.py</code> from the terminal, everything works just fine, but with cron the execution stops at the <code>import</code> statement (I read "script is executed", but noting else).</p>
  
  <p>What is going wrong?</p>
  
  <p>UPDATE: I put the import statement in a <code>try/except</code> block and it logged the exception: "No module named utilities.utility_1". I also tried to set the PYTHONPATH variable in the shell script to <code>/home/ziofil/python_scripts</code>, but it still doesn't work.</p>