On Fri, 26 May 2000, Greg Ward wrote:
On 26 May 2000, Skip Montanaro said:
I don't think you can safely compile modules by importing them. You have no idea what the side effects of the import might be.
Yeah, that's my concern.
I agree. You can't just import them.
How about fixing py_compile.compile() instead?
Would be a good thing to do this for Python 1.6, but I can't go back and fix all the Python 1.5.2 installations out there.
You and your 1.5 compatibility... :-)
Does anyone know if any good reasons why 'import' and 'py_compile.compile()' are different? Or is it something easily fixable?
I seem to recall needing to put an extra carriage return on the file, but that the Python parser was fine with the different newline concepts. Guido explained the difference once to me, but I don't recall offhand -- I'd have to crawl back thru the email. Just yell over the cube at him to find out.
Well, assuming that it is NOT okay with \r\n in there, then read the whole blob in and use string.replace() on it.