Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Python replacement for java.util.Properties.

Project Description


This is a “fork” of the “python replacement for java.util.Properties” recipe on ASPN: <> and uploaded by Anand Balachandran Pillai.

The project is maintained by Jesse Noller <>, Anand Pilla <>.


As with all ASPN recipes not otherwise licensed prior to July 15, 2008 on, the original recipe is under PSF License. For more information, see the ASPN terms of service here:


While the licensing under the PSF license is sub-optimal, it is what it is. See <> for more information about the PSF license.

What this is

This module is designed to be a python equivalent to the java.util.Properties class. Currently, the basic input/output methods are supported, and there are plans to add the XML input/output methods found in J2SE 5.0.

Fundamentally, this module is designed so that users can easily parse and manipulate Java Properties files - that’s it. There’s a fair number of us pythonistas who work in multi-language shops, and constantly writing your own parsing mechanism is just painful. Not to mention Java guys are notoriously unwilling to use anything which is cross-language for configuration, unless it’s XML, which is a form of self-punishment. :)


Here is a rough plan of features:

  • Keep/maintain blank lines and comments found in the original file
  • Make the module compatible with the new methods in J2SE 5.0
  • Switch to/add python property access rather than direct dictionary get/set
  • Add unit tests
  • Add unicode support
  • When-Pigs-Fly: If running within Jython, switch to java.util.Properties under the hood
  • Coercion/conversion to python types for values


This is the easy part:

from pyjavaproperties import Properties
p = Properties()
print p
print p.items()
print p['name3']
p['name3'] = 'changed = value'
print p['name3']
p['new key'] = 'new value''','w'))

See also the Properties.list() method, which will return an iterator over the property keys

Changes & News

  • Fix license, whitespace.
  • Patch from Pepper Lebeck-Jobe for handling ! style comments.
  • Keys that are added which were not part of the original file are simply appended to the index. Shenanigans.
  • Added an internal list (self._keyorder) to keep an ordered index of keys as they are encountered, so the file can we written-back out in the same order.
  • Initial release/fork.
  • Added setup/packaging and doc
  • added in {foo} style references for previous properties, thanks to N B on ASPN.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(7.0 kB) Copy SHA256 Hash SHA256
Source None Apr 20, 2011

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting