Splunk Dev

Python script in Splunk distance between IPs

davecroto
Splunk Employee
Splunk Employee

Cannot run this python script from the command line $SPUNK_HOME/bin/scripts, can someone tell me why?

Here is the error:

$ python distance_two_IPs.py 20, 21, 45, 25
  File "distance_two_IPs.py", line 14
    yDistance = (lat2 - lat1) * nauticalMilePerLat
            ^
IndentationError: expected an indented block

I tried to cut and past the script here, but it displayed without line-brakes. So I here is the link:

http://www.geesblog.com/2009/01/calculating-distance-between-latitude-longitude-pairs-in-python/

Tags (1)
0 Karma
1 Solution

Ayn
Legend

Just as it says, you need to indent the code within the calcDistance function. Python uses indentation instead of curly brackets.

View solution in original post

Ayn
Legend

Just as it says, you need to indent the code within the calcDistance function. Python uses indentation instead of curly brackets.

davecroto
Splunk Employee
Splunk Employee

Thanks Ayn!!

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...