Shotgun Publisher -- how to get the raw description text

I’m having some issues with getting the text from the SG publisher description.
Specifically it doesn’t register carriage returns, it just concatenates all text together. I’d rather have the raw text presented as formatted.

Also it doesn’t think there’s any text past the second carriage return. It just lops off any text beyond it.

Currently I have to add a delimiter to know where a line break is supposed to be, but that’s not an intuitive solution for artists.

Is there a way to handle this that I’m not aware of?

Thanks!

2 Likes

I just tested creating a publish, with a description that spans multiple lines, but that seems to be respected, as the text shows up in Shotgun with the new lines present.

Is this not what you are seeing, or are you doing/testing something differently?

1 Like

I’m currently working on a publisher customisation, Ill have a look if I can reproduce it!

1 Like

I just tested it again.
What’s interesting is that the publish respects how the description was formatted, say I wrote:

This
is
my
description

in the publisher description box. It would publish and show up in the SG browser exactly that way.

But if I try to use that description from the API (say in publish_file.py with item.description) it concatenates it like This is my description rather than respecting the line break.

I feel like I’m missing some part of the puzzle here. Do I need to convert the string to a different format?

To add to what I was seeing in my original post, if I just log item.description from the api, it displays the first two lines conjoined and nothing else.

So from the previous example I would get Thisis from item.description. I think this is just a weird quirk of the logging, however.

I have used the description string for other purposes in the API and it does return the whole string (albeit without line breaks)

I figured it out.

Using the _formatter_parser iterator on the description, if next() does not raise StopIteration, it has a description.
the tuple returned by the next function will contain the raw string with line breaks.
From there I split on the line break character and can format the description to my liking.

1 Like

Looks like you beat us to the punch on this one. Glad you got it sorted, and thanks for sharing back what you found!

1 Like

I know you have a solution now, but I’m surprised you needed to go to that length.

When I print out item.description I get: 'test\nover multiple\nlines\nof text.'
So for me the line breaks are there in the string.

Then I’m a bit stumped. I’m doing exactly what you’re doing.
I’m on API v3.2.1 btw

1 Like