# Determine Version of Autopsy in a Python Plugin

**URL:** <https://sleuthkit.discourse.group/t/determine-version-of-autopsy-in-a-python-plugin/218>\
**Category:** Autopsy Development\
**Created:** [August 21, 2019, 11:43am UTC](https://sleuthkit.discourse.group/t/determine-version-of-autopsy-in-a-python-plugin/218 "2019-08-21T11:43:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_McKinnon](https://yyz2.discourse-cdn.com/free1/user_avatar/sleuthkit.discourse.group/mark_mckinnon/32/42_2.png) [@Mark\_McKinnon](https://sleuthkit.discourse.group/u/Mark_McKinnon)\
**Post date:** [August 21, 2019, 11:43am UTC](https://sleuthkit.discourse.group/t/determine-version-of-autopsy-in-a-python-plugin/218/1 "2019-08-21T11:43:52Z")

</div>

If you ever need to determine the version of Autopsy that you are using here is some code that you can use to get the version numbers. You may want to do this to support different versions of Autopsy with your code:

In your import section include the following import:

```
    from org.sleuthkit.autopsy.coreutils import Version**

```

In your process method include the following code:

```
    currentVersion = Version.getVersion();
    (majorVersion, minorVersion, dotReleaseVersion) = currentVersion.split(".")
    autopsyVersion = float(majorVersion + "." + minorVersion)
    
    self.log(Level.INFO, "Version of Autopsy is ==> " + currentVersion)
    self.log(Level.INFO, "Major Version ==> " + majorVersion)
    self.log(Level.INFO, "Minor Version ==> " + minorVersion)
    self.log(Level.INFO, "Dot Release Version ==> " + dotReleaseVersion)
    
    if (autopsyVersion >= 4.12):
        self.log(Level.INFO, " This version is equal or greator then 4.12")
    else:
        self.Log(Level.INFO, " Less then 4.12")

```

The self.log statements are there so you can see what the different pieces look like, they can be removed if you do not want them.

---

<div class="post-metadata">

**Author:** ![sqrl00](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@sqrl00](https://sleuthkit.discourse.group/u/sqrl00)\
**Post date:** [March 10, 2022, 10:21pm UTC](https://sleuthkit.discourse.group/t/determine-version-of-autopsy-in-a-python-plugin/218/2 "2022-03-10T22:21:49Z")

</div>

Thanks heaps for this post, saved me heaps of time!!
