Splunk Dev

How to import custom python module inside app?

seva98
Path Finder

I have tried importing Python Docx module inside my app, I have uploaded it to .../appname/lib folder and my script inside .../appname/bin couldn't find it.

Can anyone please share an example on how to upload module to app and import it in python script?

Labels (3)
Tags (2)
0 Karma
1 Solution

seva98
Path Finder

Found what was an issue, I had to move splunklib folder to .../appname/bin folder and move Python Docx module to .../appname/bin/docx and then use

import sys
sys.path.append('./docx')
sys.path.insert(0, './docx')

View solution in original post

0 Karma

seva98
Path Finder

Found what was an issue, I had to move splunklib folder to .../appname/bin folder and move Python Docx module to .../appname/bin/docx and then use

import sys
sys.path.append('./docx')
sys.path.insert(0, './docx')
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...