title: Python script have a problem whith int() convertion whith crontab
body: <p>
  I'm checking memory of my Raspberry pi. It's work's fine.<BR><BR>
  But when I want run this every minute, crontab says have an error to convert string to int<BR><BR>
      <i>ValueError: invalid literal for int() with base 10: ''</i><BR><BR>
  My <b>script.py</b> :<BR></p>
  
  <pre><code>intmemused = 0
  cmd = "top -n1 | grep 'Mem :'| awk '{print $6;}'"
  output = Popen(cmd,shell=True, stdout=PIPE)
  memused = output.communicate()[0].strip()
  memused = str(memused.decode("utf-8"))
  print(memused) |-----------&gt; 589020
  intmemused = int(memused) #Error when crontab execute my scrypt
  mem = intmemused * 100
  mem = float(mem) / float(memtot)
  mem = 100 - float(mem)
  mem = round(mem,2)
  </code></pre>
  
  <p><BR><BR>
  My <b>crontab</b> :<BR>
  <code>*/1 * * * * /home/dietpi/&lt;b&gt;info.sh&lt;/b&gt; 2&gt;/home/dietpi/marseille.log</code><BR><BR>
  My <b>info.sh</b> :<BR></p>
  
  <pre><code>#!/bin/bash
  /usr/bin/python3 /home/dietpi/script.py
  </code></pre>
  
  <p><BR><BR>
  <b>marseille.log</b> it create to log errors when it's execute by crontab and in it have :<BR></p>
  
  <pre><code>TERM environment variable not set.
  Traceback (most recent call last):
  File "/home/dietpi/config", line 56, in &lt;module&gt;
      intmemused = int(memused)
  ValueError: invalid literal for int() with base 10: ''
  </code></pre>
  
  <p>When I look this error I've belived <b><i>memused</i></B> is empty but not. Print gived <b><i>589020</i></b><BR>
  I've belived blank character but I've used <b>.strip()</b> <BR>
  I've belived TERM environment variable not set. it's a problem, but whith this command <b><i>set | grep TERM</i></b> have a good answer <b><i>TERM=xterm</i></b><BR><BR>
  I don't undertand why it's work with python3 and not whith crontab<BR><BR>
  Can you help me ?<BR><BR>
  Thank's a lot !<BR><BR>
  MaxKweeger
  </p>