execfile is a Python 2.x. built-in function that executes Python scripts from files.
Questions tagged [execfile]
88 questions
1
vote
0 answers
Executing many python scripts via "execfile()" fails
I am using the matplotlib library for rendering charts and python-mapnik for maps out of a postgresql/postgis database. For each plot or map I use a single *.py script which works perfectly. However, if I run the python scripts from one single file…

zehpunktbarron
- 1,193
- 3
- 15
- 26
1
vote
1 answer
How do I execute a python script that is stored on the internet?
I am using python 2.4 for a program which imports scripts from the internet and executes them so a script could be changed by the author and the user wouldn't have to re-download the script.
This is the part of the program that downloads the…

Freshollie
- 171
- 6
- 13
1
vote
2 answers
execfile in it's working directory from other file
I have structure like this:
c
|-myMain.py
|-.....\someDir
|-startup.py
|-subDir
|-x.py
I've found few similar questions, and answers bring me to this:
#myMain.py
import os
if __name__ == '__main__':
…

Aleksandar
- 3,541
- 4
- 34
- 57
1
vote
0 answers
Eclipse PyDev undefined variable using execfile
I am new to PyDev, so this may be a simple answer to the question that I have.
The code that I am pulling into PyDev uses a execfile instead of a import to pull in a class from another file. I don't have control over the code, so I can't change it…

Chris
- 483
- 3
- 14
0
votes
2 answers
Run Python Script from another script and redirect script output to text file
I would like to run a second Python script and to redirect the output of this second script to a text file. The scripts and the text file are in the same folder.
I tried:
import sys
import os
path = 'my_path' # working…
user19835896
0
votes
0 answers
How to avoid child process termination
Basically, I am running one exe file using execFile method from the child process...
That exe file used ffmpeg for some conversion... If ffmpeg throws some error (Basically it won't affect the actual process) my child process is terminated…

Akbar Basha
- 1,168
- 1
- 16
- 38
0
votes
0 answers
spawn ENOENT error in windows while running execFile (node js)
Im trying to run a C file using child process in node.js. Im using execFile to do this, the 'test' file is in the same folder. The same program runs on linux and gives the output but doesn't run on windows. It shows error: spawn ./test ENONET on…

Nvv
- 79
- 10
0
votes
1 answer
Unable to serially execute ```execFile()``` with ```ffmpeg-static-electron``` binary Electron
I'm trying to split a number of .mp4 videos into .jpg images.
The set up is using electron-react-app. I have used a preload script to enable access to limited functions with the React components.
Problem: Unable to serially execute the call to…

Radespy
- 336
- 2
- 11
0
votes
0 answers
nodejs child_process spawn and exec doesn't kill process on process.kill(pid)
I am working in nodejs. I'm trying to run .cmd file using child_process spawn and exec. But none seems to work. Spawn successfully run the .cmd file when I run this script spawn('cmd', ['/c', 'start start_wMBusServices_CLI.cmd']).
but on killing…

Zeeshan Malik
- 627
- 1
- 14
- 31
0
votes
1 answer
Python execfile print none, not print value from variable
I have file mikrotik.py
'ip route add dst-address={}/{} gateway={}'.format(destination,prefix,gateway)
and this some code
import os
localfilepath = os.getcwd()
staticDir = localfilepath+"/website/plugin/config/routing/static/"
vendors =…

Adhy
- 177
- 1
- 1
- 10
0
votes
1 answer
how to show async data in UI
I wrote an async function that needs to call a program in the server and that program generate a file which needs to load in UI for displaying. I am not sure how to show the result in my UI since execFile is async function and it may take few second…

Amir
- 1,919
- 8
- 53
- 105
0
votes
0 answers
Python: Begin one script, kill the old one
I am new to python and i have some trouble with my passing from one running script to another one WITH terminating the first one. It is probably super basic, i just could not find anything on that.
With a button beeing pushed i am passing over to…
0
votes
2 answers
Use exec to execute a file inside a function with globals()
I need to execute a file inside a python shell.
I can
exec(open('Test.py').read())
But I need to call it from inside a function.
"Test.py" will set variable C=10
So,
#x.py
def load(file):
exec(open(file).read(),globals())
>>> import x
>>>…

Chinmoy Kulkarni
- 187
- 1
- 13
0
votes
0 answers
Replacement for execfile in IPython3?
There are various ways of re-enabling an execfile-like behaviour for Python 3.x environments - in the documentation and here on stackoverflow, but I did not find an exact replacement for my use case.
I am using IPython, and in Python 2.7.x execfile…

NightLightFighter
- 101
- 1
0
votes
1 answer
Passing arguments to execfile in python 2.7
I need to call one python script from another script,I'm trying to do it with the help of execfile function.I need to pass a dictionary as an argument to the calling function.Is there any possibility to do that?
import subprocess
from subprocess…

surya
- 75
- 1
- 2
- 13