The following code executed in python 2.7.2 on windows reads only part of the base file:
import os in_file = open(os.path.join(settings.BASEPATH,'CompanyName.docx')) incontent = in_file.read() in_file.close()
while this code works very well:
import io import os in_file = io.FileIO(os.path.join(settings.BASEPATH,'CompanyName.docx')) incontent = in_file.read() in_file.close()
Why is the difference? From my reading of documents, they should be executed the same way.
source share