Extract and Parse ODF Files with Python
Resources
The OASIS Open Document Format specification and related information is available for download from www.oasis-open.org/committees/tc_home.php?wg_abbrev=office.
The documentation for tags in the content.xml file can be found at www.oasis-open.org/committees/documents.php?wg_abbrev=office.
Download Python from www.python.org.
Python in a Nutshell, Alex Martelli: O'Reilly, 2003.
Python and XML, Christopher A. Jones and Fred Drake, Jr.: O'Reilly, 2001.
XML Pocket Reference, 3rd edition, Simon St. Laurent and Michael Fitzgerald: O'Reilly, 2005.
Kamran Husain has been working with software for 20 years. He can be contacted at khusain62@yahoo.com.
- « first
- ‹ previous
- 1
- 2
- 3
- 4
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Designing Electronics with Linux
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Reply to comment | Linux Journal
49 min 25 sec ago - Dynamic DNS
1 hour 23 min ago - Reply to comment | Linux Journal
2 hours 22 min ago - Reply to comment | Linux Journal
3 hours 12 min ago - Not free anymore
7 hours 14 min ago - Great
11 hours 1 min ago - Reply to comment | Linux Journal
11 hours 9 min ago - Understanding the Linux Kernel
13 hours 24 min ago - General
15 hours 53 min ago - Kernel Problem
1 day 1 hour ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
File is not a zip file
I am trying to run listing 5. Am I the only one receiving this error?
File "./odt.py", line 13, in __init__
self.m_odf = zipfile.ZipFile(filename)
File "/usr/lib/python2.6/zipfile.py", line 693, in __init__
self._GetContents()
File "/usr/lib/python2.6/zipfile.py", line 713, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.6/zipfile.py", line 725, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file
and yet . . .
>>> odfname = ('bill_of_rights.odt')
>>> zipfile.is_zipfile(odfname)
True
I'm confused is_zipfile() returns true, but I get a BadZipfile exception. Same result with several different files, so I don't think it is a bad file. Running python 2.6.4 on fedora 13.
D'OH!
the __main__ block should have:
filename = sys.argv[1]
phrase = sys.argv[2]
I keep forgetting that sys.argv[0] is a reference to the script, not the first argument to the script.
LPOD Project
lpod is an ODF library that allow to easily manipulate ODF documents.
Fail? What fail?
To the first commenter, win32 doesn't mean windows 3.2. It means 32-bit windows.
(Windows NT/2000/XP/Vista/7)
FAIL!
Python 2.4.1 (#65, Mar 30 2005, 09:13:57)
[MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()"
for more information.
however, very good tutorial doh! ;)
greets
Royma
Nice
Nice tutorials.. You'r the only one in the net that write something aboute odt and python clearly.
Do you have a tutorials to pick pictures from the odt file too?
uçak bileti
Have read all of the posts. Very interesting and much better disciplined than most sessions. and thank you for information.
Plug-in For MS Office
Instead of the ODF-Converter project on SourceForge, with its well-known flaws (cannot set ODF formats as default formats for MS Office, poor fidelity between original file and the imported/exported version, ODF placed in separate submenu instead of the usual file->save as, and intermediate saves still require long export process), I'd recommend Sun's plugin for MS Office. It features much better integration with MS Office and better fidelity import/export.
Either one will trigger warnings about the format not being fully compatible, but for most purposes, ODF is fully-capable of representing MS Office data.