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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...