format error when %s (start) in fmt string
herronelou opened this issue · comments
Erwan Leroy commented
We ran into an error this morning when trying to format a sequence '%h%s%t' (basically return the first frame of the sequence).
In the formatting, when it does the _old to _new replace, the fmt string gets edited as:
%(h)s%s%t
then:
%(h)(s)%(s)i%t
At which point it breaks because the s added in the first replace gets replaced by (s).
I got a fix but got to make unit tests then I'll make a Pull request
Ryan Galloway commented
Thanks for the report. For the record, is this the traceback you're seeing?
>>> print s.format('%h%s%t')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyseq.py", line 514, in format
return fmt % atts
ValueError: unsupported format character '(' (0x28) at index 4
And when using %s alone, I'm getting the following,
>>> print s.format('%s')
1
so you'd expect something like this, is that right?
>>> print s.format('%h%s%t')
file.1.jpg
Erwan Leroy commented
That is the error I was getting yes
The format with no padding is what I needed yes, thought the final use case
is a bit different.
(I had the nuke string with # padding, and needed to double check multiple
sequences against that string. Converted it into a regex and compared).
Could have gone many other ways, but exposed the bug.
…On Wed, Jan 2, 2019, 6:01 PM Ryan Galloway ***@***.*** wrote:
Thanks for the report. For the record, is this the traceback you're seeing?
>>> print s.format('%h%s%t')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyseq.py", line 514, in format
return fmt % atts
ValueError: unsupported format character '(' (0x28) at index 4
And when using %s alone, I'm getting the following,
>>> print s.format('%s')
1
so you'd expect something like this, is that right?
>>> print s.format('%h%s%t')
file.1.jpg
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABIK9DlC8hMq7EoZtnW7pfCOUWx12A5Fks5u_TpigaJpZM4ZkC-k>
.
Ryan Galloway commented
merged into 1.0.0 branch