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


Groups > comp.lang.python > #45503

Re: how to run another file inside current file?

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 <kevin.xgr@gmail.com>
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&gt;': 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; '&gt;': 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 <kevin.xgr@gmail.com>
Date Sat, 18 May 2013 19:15:14 +0800
Subject Re: how to run another file inside current file?
To Avnesh Shakya <avnesh.nitk@gmail.com>
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 <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.1798.1368875743.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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 = 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 <avnesh.nitk@gmail.com>

> hi,
>    I 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 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 = 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='1-12', day='1-31',
> hour='0-23',minute='44-49')
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
让我们忠于理想,让我们面对现实。

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


Thread

how to run another file inside current file? Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-05-17 21:48 -0700
  Re: how to run another file inside current file? Kevin Xi <kevin.xgr@gmail.com> - 2013-05-18 19:15 +0800
  Re: how to run another file inside current file? Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-18 12:39 -0400

csiph-web