Ticket #5129 task closed fixed
Replace usage of execfile with t.p.compat version
| Reported by: | thijs | Owned by: | itamar |
|---|---|---|---|
| Priority: | low | Milestone: | Python-3.x |
| Component: | core | Keywords: | py3k |
| Cc: | thijs, facundobatista, gavin@…, vlada.peric@… | Branch: | branches/py3-execfile-5129 |
| Author: | exarkun, allenap | Launchpad Bug: |
Description (last modified by thijs) (diff)
From porting-guide: Starting with Python 3, the execfile statement is no longer available. An alternative is to use the compile() function in conjunction with exec(). compile() can create a code object from a file, and then it can be passed into exec().
exec(compile(source_code, source_file_name, "exec"))
Some of this work has been done by loewis in #4244, but that ticket focuses on getting setup.py to run in py3k, which involves more than execfile compatibility.
Currently these modules use execfile:
./setup.py: execfile(setup_py, ns, ns)
./twisted/python/test/test_release.py: execfile("test_project", ns)
./twisted/python/test/test_release.py: execfile("test_project", ns)
./twisted/python/_release.py: execfile(self.directory.child("_version.py").path, namespace)
./twisted/python/dist.py: execfile(vfile, ns)
./twisted/web/script.py: execfile(path, glob, glob)
./twisted/web/script.py: execfile(self.filename, namespace, namespace)
./twisted/names/authority.py: execfile(filename, g, l)
./twisted/lore/htmlbook.py: execfile(filename)
where lore/htmlbook.py can be ignored because its being phased out, so small enough for this single ticket.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

