Re: 2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Martin v. Loewis
> The default replacement should be really providing a new execfile that > gets the encoding in the first 2 lines and opens it with the proper > encoding set (and properly closes the stream). No. The default replacement should really open the file in binary mode. Regards, Martin -- http://mail.p

2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Fabio Zadrozny
Right now, it seems that the default implementation of execfile in 2to3 is something as: exec(compile(open(file).read()+"\n", file, 'exec'), globals, locals) But it seems it won't deal with encodings properly... and also, in CPython just making an open without a close is OK, because of the refere