Length limit on GhPython output string?

ghpython
python
string-format

#1

I thought my GhPython would just concatenate all string items into a long string but somehow the out is broken into two. I’ve set the input s to be list access. Is it because GhPython output string has length limit?
How would I turn my list of strings into one multiline string otherwise?


(David Andres Leon) #2

It does seem like out has a length limit (@piac ?)
However, if you output to a normal output like a it works just fine:


(Giulio Piacentino) #3

Hi,

could you guys upload a definition and report expected behavior and observed behavior?
In general, the design of the out output is to print value for reading, never to pass values to other components.

There is no explicit length limit to out. There might be some length limit in the visualization, I am not sure. Please upload the definition.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(Graham) #4

Doesn’t solve the problem but for more efficiency use c = '\n'.join(s) in place of your loop


(David Andres Leon) #5

I’m still curious. here it its @piac out_len.gh (12.1 KB)


#6

we’ll have to hear it from the pros but my hunch is that it’s a render limit of the GH panel
I can’t believe I forget to simply do the a=c in your example…


(Giulio Piacentino) #7

I’ve looked into this and the reason is that IronPython’s native sys.stdout, which is the stream we print to, after some time it receives characters with new lines, decides to flush the additional lines into another write(). This is probably having to do with the buffer size.

You can see that buffering of the output stream is a heated topic:

If you want to be sure that the output does not flush in-between rows, you can just set the output as for normal output variables (a = s in your example). out is meant as developer help, and uses all the standard stream mechanisms of Python.

Thanks, I hope it solves your doubt,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


(David Andres Leon) #8

Thanks Giulio for the thorough explanation!