File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Jython/Python and the fly likes Reading Properties file in Jython Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Reading Properties file in Jython" Watch "Reading Properties file in Jython" New topic

Reading Properties file in Jython

Jacob John

Joined: Jun 21, 2004
Posts: 2
Hi All,

In my jython script i want to read a properties file like.

import java.util as util
import as javaio

properties = util.Properties
#add try catch for this
propertiesfis =javaio.FileInputStream("")
properties.load( propertiesfis)

While running this script its showing the error

File "<string>", line 19, in ?
TypeError: load(): expected 2 args; got 1

But the java syntax for java.util.Properties.load() takes only one parameter. So what else jython is expecting here?

Can any one help me in this. Thanks in advance.

Jacob John

Joined: Jun 21, 2004
Posts: 2
This got corrected. I had to use properties = util.Properties() instead of properties = util.Properties
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Ah, that makes sense. The util.Properties would be a reference to Properties.class rather than instantiating an instance of the Properties class.

Thanks for updating with the solution.

A good workman is known by his tools.
I agree. Here's the link:
subject: Reading Properties file in Jython
It's not a secret anymore!