Every time my Python application is run, it creates a log. I want to include in that log the revision number of the code that was executed. How can I do that?
I use Python 3.2, Windows TortoiseHg 2.2.2 with Mercurial 2.0.2.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using setuptools to distribute your application/package, you can access the installed package version at run time using
pkg_resources.get_distribution("my_package").version. However setuptools does not support automatic version tagging with mercurial revisions, so you will have to build your distributions with commands like:or