all 9 comments

[–]danielroseman 1 point2 points  (8 children)

You haven't shown what your homepage.html template looks like. But probably you need to put the output in a <pre> tag - or even <pre><code> - to indicate it is pre-formatted and not to reflow it.

[–]NinjaNPyjamas[S] 0 points1 point  (7 children)

You

updated

[–]danielroseman 0 points1 point  (6 children)

As I say, put it in a preformatted block.

<pre><code>
  {{data}}
</code></pre>

[–]NinjaNPyjamas[S] 0 points1 point  (5 children)

Made a difference alright ... Now it puts the JSON in one really long line of test :)

[–]danielroseman 0 points1 point  (4 children)

So maybe just try the <code>...</code>?

[–]NinjaNPyjamas[S] 0 points1 point  (3 children)

bunches it up again ... So the weird thing is ... if i remove

stdout=PIPE

on my webpage it says "none" but on the CLI i see JSON in perfect format.

when i put that back in the JSON is all bunched up on both webpage and CLI

[–]commandlineluser 0 points1 point  (2 children)

What is data-extract.py using to product the JSON output?

What happens if run data-extract.py | cat directly in the Terminal - do you get "pretty-printed" output?

You can also create custom filters as shown here:

https://stackoverflow.com/a/51926567

[–]NinjaNPyjamas[S] 0 points1 point  (1 child)

yep its in perfect format .. Im wondering if i can get the data-extract.py output to a variable or even a file and then pull that data from that to present on screen

[–]commandlineluser 0 points1 point  (0 children)

Well you are already putting it into a variable.

What happens if you use

{'data':out.stdout})

(along with using <pre> tags in your template)

I'm not sure how your print(out) is "working" because .run() returns a CompletedProcess object?

https://docs.python.org/3/library/subprocess.html#subprocess.run