replacement for execfile

Alex Popescu nospam.themindstorm at
Sat Jul 28 17:17:56 CEST 2007

Hi all!

>From another thread (and the pointed PEP) I have found that execfile will 
not be present in Py3k. So, I am wondering what will be its replacement? 
Considering that most probably Py3k will keep eval and exec, this will 
still be possible (indeed requiring manual loading of the file string), so 
I would really appreciate some enlightning comments on this.

Basically this question is related to my learning process/working project. 
In this, I have the need to allow the final user to provide a configuration 
like script, but built using my API (and whatever other normal Python code 
they want). For this, having execfile was a nice surprise as I was able to 
automatically expose the API (so the end user doesn't need to bother about 
imports) and also easily execute it in the context I wanted.

many thanks in advance,
.w( the_mindstorm )p.

More information about the Python-list mailing list