A
Avnesh Shakya
hi,
i want to run python script which generating data into json fromat, I am using crontab, but it's not executing...
my python code--
try.py --
import json
import simplejson as json
import sys
def tryJson():
saved = sys.stdout
correctFile = file('data.json', 'a+')
sys.stdout = correctFile
result = []
i = 1
for i in range(5):
info = {
'a': i+1,
'b': i+2,
'c': i+3,
}
result.append(info)
if result:
print json.dumps(result, indent=6)
sys.stdout = saved
correctFile.close()
tryJson()
now i m doing ion terminal-
avin@hp:~$ crontab -e
then type -
*/2 * * * * python /home/avin/data/try.py
and save
but it's not executing.
i want to run python script which generating data into json fromat, I am using crontab, but it's not executing...
my python code--
try.py --
import json
import simplejson as json
import sys
def tryJson():
saved = sys.stdout
correctFile = file('data.json', 'a+')
sys.stdout = correctFile
result = []
i = 1
for i in range(5):
info = {
'a': i+1,
'b': i+2,
'c': i+3,
}
result.append(info)
if result:
print json.dumps(result, indent=6)
sys.stdout = saved
correctFile.close()
tryJson()
now i m doing ion terminal-
avin@hp:~$ crontab -e
then type -
*/2 * * * * python /home/avin/data/try.py
and save
but it's not executing.