aspose file tools
The moose likes Jython/Python and the fly likes Reading Properties file in Jython Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Languages » Jython/Python
Reply Bookmark "Reading Properties file in Jython" Watch "Reading Properties file in Jython" New topic
Author

Reading Properties file in Jython

Jacob John
Greenhorn

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 java.io as javaio

properties = util.Properties
#add try catch for this
propertiesfis =javaio.FileInputStream("wasconfig.properties")
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.

Regards
Jacob
Jacob John
Greenhorn

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
Sheriff

Joined: Feb 05, 2003
Posts: 4725

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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Reading Properties file in Jython
 
Similar Threads
Jython installation with Tomcat 4.1.12
Jython doubt
how can create datasources during build time? (connection pooling api?)
modify server.startup
Jython Question