[Python-Dev] Criticism of execfile() removal in Python3 (original) (raw)
Paul Moore p.f.moore at gmail.com
Thu Jun 19 22:46:02 CEST 2014
- Previous message: [Python-Dev] Criticism of execfile() removal in Python3
- Next message: [Python-Dev] Returning Windows file attribute information via os.stat()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 19 June 2014 20:39, Joseph Martinot-Lagarde <joseph.martinot-lagarde at m4x.org> wrote:
Another way is to open the file in binary, then exec() checks itself if an encoding is defined in the file. This is what is used in spyder:
exec(open(file, 'rb').read()) Here is the discussion for reference: https://bitbucket.org/spyder-ide/spyderlib/pull-request/3/execution-on-current-spyder-interpreter/diff
It would be good to document this. Could you open a docs bug to get this added?
Paul
- Previous message: [Python-Dev] Criticism of execfile() removal in Python3
- Next message: [Python-Dev] Returning Windows file attribute information via os.stat()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]