Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'url:launchpad': 0.05; 'json': 0.07; 'sys': 0.07; 'skip:/ 10': 0.09; 'subject:script': 0.09; '--------': 0.10; 'python': 0.11; 'def': 0.12; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:mobistar.be': 0.16; 'sujet:': 0.16; 'sys.stdout': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; '\xe9crit': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; '+0200': 0.26; 'header:In-Reply-To:1': 0.27; 'run': 0.32; 'running': 0.33; 'info': 0.35; 'created': 0.35; 'but': 0.35; 'doing': 0.36; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'generating': 0.39; 'to:addr:python.org': 0.39; 'subject:Fwd': 0.61; 'save': 0.62; 're:': 0.63; '2013': 0.98 Date: Sat, 18 May 2013 16:09:40 +0200 From: Vincent Vande Vyvre User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Python mail-list Subject: Fwd: Re: python script is not running References: <519759C7.7000200@swing.be> In-Reply-To: <519759C7.7000200@swing.be> X-Forwarded-Message-Id: <519759C7.7000200@swing.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368886641 news.xs4all.nl 15969 [2001:888:2000:d::a6]:38824 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45512 -------- Message original -------- Sujet: Re: python script is not running Date : Sat, 18 May 2013 12:36:55 +0200 De : Vincent Vande Vyvre Pour : Avnesh Shakya Le 18/05/2013 12:12, Avnesh Shakya a écrit : > 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. Have a look at /var/mail/yourname, this is a log created by crontab. -- Vincent V.V. Oqapy . Qarte . PaQager