Posts: 177
Joined: Feb 2009
Reputation:
0
jonm42
Senior Member
Posts: 177
Greetings. I am running into newline characters embedded within a plot description, which blows things up with the classic EOL seen while parsing single quoted string problem. I could always tack on a .replace('\n', ' ') on the end, but that would wreck the visual layout. I've done significant searching both in here and general python documentation but haven't found anything. How to cope with this situation or perhaps keywords I could use for more targeted searching would be greatly appreciated. Thanks!
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
s/\n/[CR]/g
prior to passing it to the textbox/whatever
Posts: 177
Joined: Feb 2009
Reputation:
0
jonm42
Senior Member
Posts: 177
I believe the appropriate word here is "doh!" followed by smacking myself in the forehead.
Posts: 177
Joined: Feb 2009
Reputation:
0
jonm42
Senior Member
Posts: 177
Well, that stopped it from blowing up, but it also eliminated the overall structure of the plot listing -- it's now one big glob.
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
if lines are too large to fit we will chop them disregarding the formatting. not much else one can do...
Posts: 177
Joined: Feb 2009
Reputation:
0
jonm42
Senior Member
Posts: 177
Any ideas, please? Putting out the plot in a blob is just plain ugly.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
quote_plus(plot)
unquote_plus(plot)
both are in the urllib module
Posts: 177
Joined: Feb 2009
Reputation:
0
jonm42
Senior Member
Posts: 177
Will give that a shot. Thanks!
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
forgot the repr()
quote_plus(repr(plot))
unquote_plus(repr(plot))