All Apps and Add-ons

ERROR ScriptRunner - from splunk.clilib import cli_common as cli

jangid
Builder
02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  Traceback (most recent call last):

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py", line 3, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  from icontrol import iControlActiveWindow

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\etc\apps\myapp\bin\icontrol\__init__.py", line 1, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  from activewindow import iControlActiveWindow

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\etc\apps\myapp\bin\icontrol\activewindow.py", line 6, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  from search_helper import iControlSearch

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\etc\apps\myapp\bin\icontrol\search_helper.py", line 5, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  from config import iConfig

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\etc\apps\myapp\bin\icontrol\config.py", line 3, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  from splunk.clilib import cli_common as cli

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  File "C:\Program Files\Splunk\Python-2.7\Lib\site-packages\splunk\clilib\cli_common.py", line 6, in <module>

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  import lxml.etree as etree

02-28-2018 09:26:30.386 ERROR ScriptRunner - stderr from 'C:\Program Files\Splunk\bin\PYTHON.EXE C:\Program Files\Splunk\etc\apps\myapp\bin\activewindow_command.py sampleTime targetType_id':  ImportError: DLL load failed: %1 is not a valid Win32 application.

02-28-2018 09:26:30.387 INFO  script - Invoked script activewindowslookup with 14278 input bytes (54 events).  Returned 87 output bytes in 3050 ms.

Here is my python script code

from __future__ import print_function
import httplib2
import urllib
import json
from xml.dom import minidom
import splunklib.client as client
from splunk.clilib import cli_common as cli

class iConfig:
    config = None

    def __init__(self):
        self.config = cli.getConfStanza('mycontrol','control_setup')

When I run same script using python command it is working fine, here is the command line to run the script

$SPLUNK_HOME\bin\splunk.exe cmd python <myscriptname>

Any clue to fix this issue?

Tags (1)
0 Karma

p_gurav
Champion

Can you try import splunk.clilib.cli_common as cli?

Also check your system architecture, 32 or 64 bit.

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...