0

I have following in my Python script:

What I try to do is

read a partial source code(e.g. line 20 to line 40) to buffer and pip/apply the IOSTREAM to pygmentize so that I can generate code highlighting for the partial source code.(e.g. line 20 to line 40)

Currently, I create partial tmp file for the partial source code(e.g. line 20 to line 40) and use the tmp file on pygmentize.

subprocess.call(["pygmentize", "-f", "html", "-o", htmlFile, tmpFileName])

tmpFileName is the file name for the code that I want to highlight.

My Question:

How can I create IOSTREAM and pip/apply the IOSTREAM to pygmentize so that I don't have to create tmp file in /tmp directory

Any suggestion would be appreciated!

Community
  • 1
  • 1
elliptic00
  • 427
  • 4
  • 13

0 Answers0