execfile is a Python 2.x. built-in function that executes Python scripts from files.
Questions tagged [execfile]
88 questions
1
vote
0 answers
Node.js child_process.execFile() not working with own .exe
I am just trying to dive into Node.js and I am testing basic functionalities that I consider helpful to accomplish my project. One of them would be executing a small .exe file I coded in C++ that processes data from text files. I figured out that…

emigrand
- 11
- 3
1
vote
1 answer
How can I use child_process to run a bash script that returns a list of values?
How can I call the execFile method from child_process to run a bash script that returns a list of values?
My bash file (test.sh) returns a list of 8 values but the below script is printing only the last item of the list.
const { execFile } =…

Arena Hernandez
- 51
- 4
1
vote
1 answer
Python 2.4: Speed of imports in normal script vs imports in execfile'd script
I've just stumbled across something that makes no sense to me. Where I work, we have a number of Python CGI webpages (just a simple Apache server setup, not running Django / Turbogears or the like) and I've been getting a bit frustrated with how…

FredL
- 961
- 7
- 13
1
vote
1 answer
How to run python scripts one after the other by selecting the tests using easygui?
I am using the following code to select the tests i want to run one after the another.
from easygui import *
import sys,os
msg="Select following tests for testing"
title="Test…

user1681102
- 193
- 2
- 4
- 13
1
vote
2 answers
Python script runs twice in Autodesk Maya when sent with execfile
I need to send a script to Maya from an external software written in Maya. I tried to do this with a small example:
import socket
import time
from os.path import abspath
ADDR=('127.0.0.1',666)
def execute_file(fileFullPath):
client =…

Purrrple
- 133
- 6
1
vote
1 answer
No module named ... When I call a script via execfile(pyscript)
I have a question about executing a script via execfile() in Python
My main script is located at home/pi/var/www/html/main.py. My second script is home/pi/start.py and includes several modules.
When I execfile("/home/pi/start.py") I get this…

Helze
- 11
- 3
1
vote
1 answer
How to stop a python subprocess which is running unit tests right away? Terminate and kill not working
I have a Tkinter GUI running two threads, the main tread for the GUI and a worker thread. The worker thread creates a subprocess using the following code:
myProcess = subprocess.Popen(['python', '-u', 'runTests.py'],
…

Mario
- 85
- 1
- 2
- 7
1
vote
1 answer
Execfile running the file twice when used with import
I want to have a textbox and a button in my GUI and on clicking the button, it should take the text and store it in a variable for some other file and run the other file.
I want the user to enter an access token and the GUI should save it in the…

ronilp
- 455
- 2
- 9
- 25
1
vote
3 answers
How do I reference several scripts with similar names in Python with a "for" statement?
I want to execute several .py files that have similar names. The goal is call on a1.py, a2.py, and a3.py. I've tried what is below, but I can't get it to work. How do I insert each element in "n" into the filename to execute several scripts? Thanks…

Matt
- 13
- 4
1
vote
1 answer
Functions defined in dynamically-loaded scripts cannot refer to each other
I'm trying to load functions from a script dynamically when I'm inside an ipython interactive shell. For example, suppose I have a python script like this:
# script.py
import IPython as ip
def Reload():
execfile('routines.py', {}, globals())
if…

shaoyl85
- 1,854
- 18
- 30
1
vote
1 answer
how to exit python execfile() with out exiting whole script
I have a code which runs mutile python codes such as below:
execfile("1.py")
execfile("2.py")
execfile("3.py")
however occasionally one of the above codes as an error, i put exit('error') in the code to cancell if there is an error. However i want…

astrochris
- 1,756
- 5
- 20
- 42
1
vote
1 answer
Calling python compiled files in Python 3
I have multiple Python versions installed (2.7 and 3.4)
I want to run a .pyc with specified version of Python
#! C:\python34\python
import sys
print("Hello",sys.version.split()[0])
input()
This sheebang works fine on Windows because I use…

Baghera
- 53
- 6
1
vote
2 answers
Python interpreter's relationship with scripts
In my current directory, I have a foo1.py script and a directory named other with a foo2.py script inside.
Now:
I launch the interpreter, and using execfile I can launch both scripts. The thing is, when I edit and save foo1.py, I don't have to…

Lanfear
- 325
- 2
- 6
1
vote
2 answers
python: functions *sometimes* maintain a reference to their module
If I execfile a module, and remove all (of my) reference to that module, it's functions continue to work as expected. That's normal.
However, if that execfile'd module imports other modules, and I remove all references to those modules, the…

bukzor
- 37,539
- 11
- 77
- 111
1
vote
2 answers
Script calling multiple other scripts erroring due to undefined functions
I'm unsure again with something what I'm sure is going to be very simple...
Basically, I'm trying to make my first script call/execute a bunch of other scripts but the problem is I want each individual script to contain its own functions not be…

Ryflex
- 5,559
- 25
- 79
- 148