473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Script executes script?

Hello,

for a testmodule I need to execute a python script from within a
python script. Something like:

-- ScriptA -->
import whatever

RunScript("scriptb.py")
RunScript("scriptc.py")
<-- Script A --

Is this possible? I didn't find a possibility to do this.

Would be nice if you could give me some advice here.

Thank you,
Mipe
Jul 18 '05 #1
6 1692
On Wed, 01 Sep 2004 11:13:57 +0200, Michel Claveau - abstraction
méta-galactique non triviale en fuite perpétuelle. wrote:
Try execfile(


Alternatively, on Unix at least,

import os
os.system('other.py')

Assuming other.py is an executable. This will give you a completely new
interpreter.

Jeremy

Jul 18 '05 #3
Mipe wrote:
Hello,

for a testmodule I need to execute a python script from within a
python script. Something like:

-- ScriptA -->
import whatever

RunScript("scriptb.py")
RunScript("scriptc.py")
<-- Script A --

Is this possible? I didn't find a possibility to do this.

Would be nice if you could give me some advice here.

Thank you,
Mipe

import os
path_to_python = "c:\\Python23\\python.exe"
path_to_script = "e:\\temp\\test.py"
os.system(path_to_python + " " + path_to_script)

Jul 18 '05 #4
Bonjour !

It's OK also with windows, like popen, pawn, etc.
But execfile( is more fast, and need minus memory.
Michel Claveau


Jul 18 '05 #5
Vladimir Ivanov wrote:
import os
path_to_python = "c:\\Python23\\python.exe"
path_to_script = "e:\\temp\\test.py"
os.system(path_to_python + " " + path_to_script)


Ugh. At least use sys.executable to find the
interpreter if you're going to do it this way.

-Peter
Jul 18 '05 #6
On Wed, 01 Sep 2004 12:26:49 +0200, Michel Claveau - abstraction
méta-galactique non triviale en fuite perpétuelle. wrote:
It's OK also with windows, like popen, pawn, etc. But execfile( is more
fast, and need minus memory.


Of course. Occasionally you want an extra process, however!

Jeremy

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
5
by: Phil Powell | last post by:
I'm sorry but I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure...
1
by: Ruben Duarte | last post by:
Hi, Anybody knows if is posible in Linux with PHP to do upload of several files sending the data before that php script executes. Now in my server you do the upload (with html,form, multipart...
3
by: #pragma once | last post by:
That's all we are expecting from programs written in the managed code; Though a MVP advised not to say that, because after JIT compilation the code runs in the native! Funny, isn't? That means...
1
by: Russ | last post by:
I've been trying to get my head around this for 3 days now and it seems like everything I try does not work for one reason or another. I built a test page using the TabStrip and MultiPage controls....
6
by: Guadala Harry | last post by:
I have some client-side JavaScript that, among other things, calculates the value of a variable (myVar). On the server I have a stored procedure that needs to somehow receive as an input parameter...
4
by: wizard | last post by:
Hello dear friends, I am writing a small program to test transactions in php. But when I try to simulate an error condition during transaction, my php script aborts. It does rollback work, but...
5
by: widevision7 | last post by:
I am creating a web site where I want to have a hyperlink that executes a Perl script. At the same time, I want to pass along a variable inside of the hyperlink that the Perl script can use when it...
11
by: wxy212 | last post by:
i know that in python, os.system(cmd) can be used to execute a script or command, and the return value is 0 if successful, rather than the standard output of the script that it executes. e.g. ...
0
by: mag | last post by:
I have a make file that executes a perl script that takes PERL as an eval. The script executes the eval() function via an arguement to the script like this: target: script $(ARGUMENT) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.