execfile is a Python 2.x. built-in function that executes Python scripts from files.
Questions tagged [execfile]
88 questions
3
votes
1 answer
Node js child_process.execFile return
I need to run a compiled file in C + + with node.js and bring me back a value from this file.
I tried to use child_process.execFile, but I have no problems.
This is the function I use:
var exec = require('child_process');
Test.prototype.write =…

Hikari
- 589
- 7
- 29
3
votes
2 answers
Execution of execfile() in a method with Python
I have a config.py script that has PREAMBLE information. I can use execfile() function to read the contents of the configuration file.
execfile("config.py")
print PREAMBLE
>>> "ABC"
However, when execfile() is called in a method, I have an error.…

prosseek
- 182,215
- 215
- 566
- 871
3
votes
0 answers
The Python 3.3 equivalent of 'execfile'
I need to find out how to open my .py files after writing them in Notepad++. I find the interface more useful than the Python window.
In a tutorial I was following along with the guy uses
execfile(pathway)
but execfile does not work in 3.3.
Is…

Deaven Morris
- 107
- 1
- 3
- 13
3
votes
1 answer
How to execute code string in Python?
I know there is a question similar to it here but I am having a different problem.
I have some code files in a plugin but the plugin uses internal paths only the software knows, so I am not able to access that path to use it with execfile.
But there…

Joan Venge
- 315,713
- 212
- 479
- 689
2
votes
2 answers
How can keep child process alive even if parent process is terminated
I have an Electron app and I have to launch an exe file and quit the app. The problem is when I try to quit, app closes and exe file launched before too... I want my exe file opened instead...
This is my code
var execFile =…

Daniele
- 41
- 4
2
votes
1 answer
Isolating child processes using Containers
I am trying to implement a server in Node Js which simultaneously takes as input, multiple code files in other languages like python,c++ etc, simultaneously runs them in child process using ExecFile and then returns the outputs. However, I think…

Taimoor Ali
- 158
- 1
- 7
2
votes
2 answers
Python shell and execfile scope
I'm working from inside an ipython shell and often need to reload the script files that contain my functions-under-construction.
Inside my main.py I have:
def myreload():
execfile("main.py")
execfile("otherfile.py")
Calling myreload() works…

GJ.
- 5,226
- 13
- 59
- 82
2
votes
1 answer
execfile() for configuration - error no such file or directory
I'm trying to use execfile() function to use a file as config file. The file has only a bunch of variables and values. But when I'm trying to use it in my code, it throws IOError: [Errno 2] No such file or directory
This is my code:
dictionary =…

sidx
- 640
- 2
- 11
- 28
2
votes
4 answers
Exit to command line in Python
I have a script that I want to exit early under some condition:
if not "id" in dir():
print "id not set, cannot continue"
# exit here!
# otherwise continue with the rest of the script...
print "alright..."
[ more code ]
I run this script…

fuenfundachtzig
- 7,952
- 13
- 62
- 87
2
votes
1 answer
what is the diffrence between subprocess and execfile
Could you tell me what is difference between execfile and subprocess . I guess these two commands work same .
but when I use Execfile() there is no problem getting variable from another .py file . but when I try to use subprocess.Popen() there is…

pythoner
- 23
- 1
- 5
2
votes
1 answer
"execfile" doesn't work properly
I'm trying to make a launcher for my Python program with Tkinter. I used the execfile function, and fortunately it opened the target GUI. However, none of the buttons would work, and it would say the global variable most functions reference isn't…

Majora64
- 23
- 4
2
votes
2 answers
execfile() cannot be used reliably to modify a function’s locals
The python documentation states "execfile() cannot be used reliably to modify a function’s locals." on the page http://docs.python.org/2/library/functions.html#execfile
Can anyone provide any further details on this statement? The documentation is…

user1748155
- 1,345
- 1
- 9
- 17
2
votes
1 answer
How do I run a python file in pylab, which executes another python file?
I want to create a startup configuration that runs a file that I request. So far, my configuration file is as follows:
path1=input('What folder would you like to open?')
os.chdir('C:\\Users\\Owner\\Documents\\Spring…

user2150754
- 21
- 1
2
votes
1 answer
execfile() in python , using it for user input
I am trying to take in a filename from a user and then use execfile() to execute the file. Below is my code:
print "Please enter the name of the file"
filename = raw_input().split(".")[0]
module = __import__(filename)
execfile(module) …

user1801279
- 1,743
- 5
- 24
- 40
1
vote
2 answers
How to get the status of an async function before it's finished?
I'm using NodeJs execFile() to start a daemon process. I've wrapped the callback in a promise to use it asynchronously in other parts of my application.
I understand callbacks emit err/result upon completion. So when the daemon process fails, the…

Roscoe van der Boom
- 11
- 4