Help using forward slashes inside f-strings #226
-
I'm playing around with path formats and noticed that if I put a slash inside an f-string then Moe fails to parse it as it thinks it's an unterminated f-string (see I tried some combinations but couldn't get this to work (probably my Python is rusty). I don't think the nested f-string is the issue but rather it seems like the track_path = "{f'Disc {track.disc:1d}/{track.disc:1d}-' if album.disc_total > 1 else ''}{track.track_num:02d}. {track.title}{track.path.suffix}"
^ Stacktrace:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Indeed looks like Moe/moe/plugins/move/move_core.py Line 148 in de6ebd2 This might not be an issue for me since I'm planning on writing a plugin to handle disc and track numbering for me, but I'm wondering whether this is an intentional limitation or a bug. This can also show up in cases where you want to divide a number, e.g. |
Beta Was this translation helpful? Give feedback.
Indeed looks like
track_path
is split with/
as a separator so you cannot have/
inside an f-string intrack_path
otherwise the splitting produces unterminated f-strings.Moe/moe/plugins/move/move_core.py
Line 148 in de6ebd2
This might not be an issue for me since I'm planning on writing a plugin to handle disc and track numbering for me, but I'm wondering whether this is an intentional limitation or a bug.
This can also show up in cases where you want to divide a number, e.g.
{f'track.sample_rate/1000'}kHz
.