Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'example:': 0.03; 'subject:file': 0.07; 'exec': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'doc:': 0.16; 'subject:run': 0.16; '\xc2\xa0i': 0.16; 'possible,': 0.19; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'specify': 0.24; 'file.': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In- Reply-To:1': 0.27; 'kevin': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'file': 0.32; 'run': 0.32; 'another': 0.32; 'url:python': 0.33; 'skip:s 30': 0.35; 'more,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'version': 0.36; 'url:listinfo': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'unable': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'easy': 0.60; 'to:addr:gmail.com': 0.65; 'here': 0.66; '8bit%:100': 0.72; 'url:reference': 0.84; 'execution,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=nlh8uxPv8Apb4bbmRS9wWM+teZOQtwkUV53xdBSZ1IU=; b=xXIIIg3fUZGetHYLzty5/6MOTVeHCrdIOJEMoYbVIT17foxCg8Kym5EwOhjQF5pc9c I/4cc2MYJWKSz2qPH1lq7ghgwzg30K3231qcvxqd4pJOotIBZ4M+zkpbf63hS9B4AF0Q nflrB5V/UmC5YSDLFsK7be8StV2giNOf3qTHovGBMg8WpieZX30p9ipuI4z35CMfFGl+ JghrKKxk+ZjA0oJ/aXymhO+waOvZeD6VOAu9D/nePjiGCrhVUkZLvC4KJy7z9O1vvHA8 d86WJoCDcCrZaCMKwM0S5ZBg2Fn0+Mr8lTn6A6+409vhRKXeLL327M1+U2LTrte0YKLV ZSoQ== X-Received: by 10.58.188.82 with SMTP id fy18mr31492170vec.41.1368875735045; Sat, 18 May 2013 04:15:35 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <67c4dd92-7e6a-4955-850b-0c21c2708e05@googlegroups.com> References: <67c4dd92-7e6a-4955-850b-0c21c2708e05@googlegroups.com> From: Kevin Xi Date: Sat, 18 May 2013 19:15:14 +0800 Subject: Re: how to run another file inside current file? To: Avnesh Shakya Content-Type: multipart/alternative; boundary=089e011847faede07404dcfc3754 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 112 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368875743 news.xs4all.nl 15894 [2001:888:2000:d::a6]:38895 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45503 --089e011847faede07404dcfc3754 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, It's better to specify version of python you work with. I know nothing about python 3 but in python 2 you can do this with `exec`. Example: > f =3D file('otherFile.py') > exec f For more, read the doc: http://docs.python.org/2.7/reference/simple_stmts.html#the-exec-statement HTH Kevin 2013/5/18 Avnesh Shakya > hi, > I want to run a another file inside a ached.add_cron_job(..). how is i= t > possible, please help me, I have a file otherFile.py for execution inside > current file. > I know it is very easy question but i m unable to get anything, please > help me. > example -- > > import otherFile > from apscheduler.scheduler import Scheduler > sched =3D Scheduler() > sched.start() > > def job_function(): > # Can I here add that file for execution, Or can i add that file > directly inside cron? > > sched.add_cron_job(job_function, month=3D'1-12', day=3D'1-31', > hour=3D'0-23',minute=3D'44-49') > -- > http://mail.python.org/mailman/listinfo/python-list > --=20 =E8=AE=A9=E6=88=91=E4=BB=AC=E5=BF=A0=E4=BA=8E=E7=90=86=E6=83=B3=EF=BC=8C=E8= =AE=A9=E6=88=91=E4=BB=AC=E9=9D=A2=E5=AF=B9=E7=8E=B0=E5=AE=9E=E3=80=82 --089e011847faede07404dcfc3754 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,
It's better to=C2=A0specify version of python = you work with. I know nothing about python 3 but in python 2 you can do thi= s with `exec`. Example:

> f =3D file('other= File.py')
> exec f

HTH

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Kevin

2013/5/18 Avnesh Shakya <avnesh.nitk@gmail.com>
hi,
=C2=A0 =C2=A0I want to run a another file inside a ached.add_cron_job(..). = how is it possible, please help me, I have a file otherFile.py for executio= n inside current file.
I know it is very easy question but i m unable to get anything, please help= me.
example --

import otherFile
from apscheduler.scheduler import Scheduler
sched =3D Scheduler()
sched.start()

def job_function():
=C2=A0 =C2=A0 # Can I here add that file for execution, Or can i add that f= ile directly inside cron?

sched.add_cron_job(job_function, month=3D'1-12', day=3D'1-31= 9;, hour=3D'0-23',minute=3D'44-49')
--
http://mail.python.org/mailman/listinfo/python-list



-- =E8=AE=A9=E6=88=91=E4=BB=AC=E5=BF=A0=E4=BA=8E=E7=90=86=E6=83=B3=EF=BC=8C= =E8=AE=A9=E6=88=91=E4=BB=AC=E9=9D=A2=E5=AF=B9=E7=8E=B0=E5=AE=9E=E3=80=82
--089e011847faede07404dcfc3754--