Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45504
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <fjctlzy@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:not': 0.03; 'json': 0.07; 'sys': 0.07; 'subject:script': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'sys.stdout': 0.16; 'subject:python': 0.16; 'cc:addr:python.org': 0.22; 'print': 0.22; 'received:192.168.1.100': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; 'absolute': 0.30; 'url:mailman': 0.30; 'run': 0.32; 'url:python': 0.33; 'info': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'generating': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'save': 0.62; 'such': 0.63; 'to:addr:gmail.com': 0.65; '8bit%:100': 0.72 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:subject:message-id:from:to:cc:mime-version :content-type:content-transfer-encoding; bh=YDwxRtGFhUnI1Wf6P/2P48X5gSkVS78FK5wyqk5uQYM=; b=n1e7X0GgzNGh5FTnkcve8tjDke0NiDwxLzcYi03AJgjxPcq1uA9kR9Vywwf93pyTLD YLqF/5x+k7B97f4T2Ti1kjXOBSrT5O1V6iJmnFu35YSZhvHEZCCd2yOVEjNn7eciiOaF MEehsAyoJTJlhNhGPRGW5aCxvJc2n/Kn/we9AkRwq2LbuDSl5miFOD96zidKM1TekClW gMAMhsS4g9zlzKK2y8MU8azMlWVf3mHj7nej/nsRiIFQIMf3RJjk5Q+1gcypl1HtMO/j ncLZSqdCVqsS36UvXfRSIUh/rLFQTYrHhRxuxINXD/qxQJz13C3L38DtF0SBIW1lTYrd a1GQ== |
| X-Received | by 10.68.105.164 with SMTP id gn4mr52061110pbb.42.1368875925097; Sat, 18 May 2013 04:18:45 -0700 (PDT) |
| Date | Sat, 18 May 2013 19:18:40 +0800 |
| Subject | Re: python script is not running |
| From | "fjctlzy@gmail.com" <fjctlzy@gmail.com> |
| To | Avnesh Shakya <avnesh.nitk@gmail.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | base64 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1799.1368875934.3114.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1368875934 news.xs4all.nl 15995 [2001:888:2000:d::a6]:41642 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45504 |
Show key headers only | View raw
make sure data.json is absolute path
make sure you test it directly without crontab
in the crontab, execute the script in such way, python scripty > /tmp/log 2>&1 check the log
发自我的小米手机
Avnesh Shakya <avnesh.nitk@gmail.com>编写:
>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.
>--
>http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python script is not running "fjctlzy@gmail.com" <fjctlzy@gmail.com> - 2013-05-18 19:18 +0800
csiph-web