Commits

Philippe Lagadec committed c254f9b

version 0.23 - updated readme and setup.py

Comments (0)

Files changed (3)

OleFileIO_PL/README.txt

 News
 ----
 
+-  2012-09-11 v0.23: added support for file-like objects, fixed `issue
+   #8 <https://bitbucket.org/decalage/olefileio_pl/issue/8/bug-with-file-object>`_
 -  2012-02-17 v0.22: fixed issues #7 (bug in getproperties) and #2
    (added close method)
 -  2011-10-20: code hosted on bitbucket to ease contributions and bug
         # Test if a file is an OLE container:
         assert OleFileIO_PL.isOleFile('myfile.doc')
 
-        # Open an OLE file:
+        # Open an OLE file from disk:
         ole = OleFileIO_PL.OleFileIO('myfile.doc')
 
         # Get list of streams:
             f.write(data)
             f.close()
 
+        # Close the OLE file:
+        ole.close()
+
+        # Work with a file-like object (e.g. StringIO) instead of a file on disk:
+        data = open('myfile.doc', 'rb').read()
+        f = StringIO.StringIO(data)
+        ole = OleFileIO_PL.OleFileIO(f)
+        print ole.listdir()
+        ole.close()
+
 It can also be used as a script from the command-line to display the
 structure of an OLE file, for example:
 

OleFileIO_PL/setup.py

 # 2007-12-04 v0.03 PL: - updated description, added debug_mode test
 # 2009-09-11 v0.04 PL: - updated URL, e-mail, licence, disabled e-mail
 # 2012-02-16 v0.05 PL: - added download URL on bitbucket
+# 2012-09-11 v0.06 PL: - read long description from disk in rst format
 
 import distutils.core
 
     'name': "OleFileIO_PL",
     'version': __version__,
     'description': "A Python module to parse and read Microsoft OLE2 files (Structured Storage or Compound Document, Microsoft Office) - Improved version of the OleFileIO module from PIL, the Python Image Library.",
+    # read long description from disk in restructuredtext format:
+    'long_description': open('README.txt').read(),
     'author': __author__,
     #'author_email': "decalage(a)laposte.net",
     'url': "http://www.decalage.info/python/olefileio",
 News
 ----
 
+- 2012-09-11 v0.23: added support for file-like objects, fixed [issue #8](https://bitbucket.org/decalage/olefileio_pl/issue/8/bug-with-file-object)
 - 2012-02-17 v0.22: fixed issues #7 (bug in getproperties) and #2 (added close method)
 - 2011-10-20: code hosted on bitbucket to ease contributions and bug tracking
 - 2010-01-24 v0.21: fixed support for big-endian CPUs, such as PowerPC Macs.
 		# Test if a file is an OLE container:
 		assert OleFileIO_PL.isOleFile('myfile.doc')
 		
-		# Open an OLE file:
+		# Open an OLE file from disk:
 		ole = OleFileIO_PL.OleFileIO('myfile.doc')
 		
 		# Get list of streams:
 		    f = open('Pictures.bin', 'w')
 		    f.write(data)
 		    f.close()
+
+		# Close the OLE file:
+		ole.close()
+		
+		# Work with a file-like object (e.g. StringIO) instead of a file on disk:
+		data = open('myfile.doc', 'rb').read()
+		f = StringIO.StringIO(data)
+		ole = OleFileIO_PL.OleFileIO(f)
+		print ole.listdir()
+		ole.close()
 		
 		
 It can also be used as a script from the command-line to display the structure of an OLE file, for example: