I am brand new to Python. I have some python script which is accessed by other project to read some data from this python script.
If suppose I need to provide the version information for the other project from this python script, I was having a class variable which was hard coded and it was working fine till now.
I wanted to change the way of providing the version information so I choose to read the properties file instead of hard coding. I have added these line in my script
previously it was just this line
version = '1.2'
config = ConfigParser.RawConfigParser()
version = config.get('global', 'version')
version.properties file will be in the same directory as your code, you can use this:
import os config.read(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'version.properties'))