Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45500

python script is not running

X-Received by 10.224.165.130 with SMTP id i2mr30065871qay.2.1368871951484; Sat, 18 May 2013 03:12:31 -0700 (PDT)
X-Received by 10.50.117.106 with SMTP id kd10mr146492igb.14.1368871951314; Sat, 18 May 2013 03:12:31 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!l3no9731126qak.0!news-out.google.com!y6ni50164qax.0!nntp.google.com!gj8no1297543qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sat, 18 May 2013 03:12:30 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=122.179.39.75; posting-account=o4PhMQoAAAD3VECHQD4L7c0EPfi-y8z2
NNTP-Posting-Host 122.179.39.75
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <bb111639-6a94-4151-a153-9bbebe75a4ea@googlegroups.com> (permalink)
Subject python script is not running
From Avnesh Shakya <avnesh.nitk@gmail.com>
Injection-Date Sat, 18 May 2013 10:12:31 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:45500

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

python script is not running Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-05-18 03:12 -0700
  Re: python script is not running Chris Angelico <rosuav@gmail.com> - 2013-05-18 23:28 +1000
    Re: python script is not running Roy Smith <roy@panix.com> - 2013-05-18 09:44 -0400
  Re: python script is not running Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-18 12:35 -0400
  Re: python script is not running woooee <woooee@gmail.com> - 2013-05-18 10:35 -0700
    Re: python script is not running Chris Angelico <rosuav@gmail.com> - 2013-05-19 03:59 +1000
    Re: python script is not running Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-05-18 20:43 +0200
    Re: python script is not running Chris Angelico <rosuav@gmail.com> - 2013-05-19 09:33 +1000

csiph-web