Splunk Dev

Why am I receiving Splunk Extension for VSCode debugger error on custom command

joshiro
Communicator

The python debugger in the Splunk Extension does not work when debugging a custom command (reporting command). It runs fine without the debugger, but when using the debugger it crashes at the dispatch() function and returns the following traceback:

 

Traceback (most recent call last):
  File "/opt/splunk/etc/apps/<app>/bin/<command>.py", line 149, in <module>
    dispatch(exportExcel, sys.argv, sys.stdin, sys.stdout, __name__)
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/search_command.py", line 1144, in dispatch
    command_class().process(argv, input_file, output_file, allow_empty_input)
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/search_command.py", line 450, in process
    self._process_protocol_v2(argv, ifile, ofile)
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/search_command.py", line 788, in _process_protocol_v2
    self._record_writer.write_metadata(self._configuration)
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/internals.py", line 813, in write_metadata
    self._write_chunk(metadata, '')
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/internals.py", line 843, in _write_chunk
    self.write(start_line)
  File "/opt/splunk/etc/apps/<app>/bin/../lib/splunklib/searchcommands/internals.py", line 557, in write
    self.ofile.write(data)
  File "/opt/splunk/etc/apps/SA-VSCode/bin/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_io.py", line 40, in write
    r.write(s)
TypeError: write() argument must be str, not bytes

 


The custom running code is similar to the python examples in the SDK repo in: https://github.com/splunk/splunk-sdk-python/tree/master/examples/searchcommands_app/package/bin

Any help ll be appreciated.

Labels (2)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

If you think that's the issue with the VS code extension you can submit the issue here - https://github.com/splunk/vscode-extension-splunk 

joshiro
Communicator

Already did that, but no response so far.
https://github.com/splunk/vscode-extension-splunk/issues/54

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...