On Tuesday, June 11, 2013 11:37:17 AM UTC-4, Neil Cerutti wrote: > On 2013-06-10, dhyams <dhy...@gmail.com> wrote: > > > On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: > > >> Can you read the file into a string, prepend a future directive, and > > >> > > >> then compile the string? > > > > > > Technically yes, except that now there is complication of > > > writing the modified module back to a file so that I can still > > > use py_compile.compile() to byte compile that code. > > > > You would use StringIO instead of writing a temp file. >
I don't think that would work...py_compile takes a filename as input, not a file object. -- http://mail.python.org/mailman/listinfo/python-list