FinderSidebarEditor
FinderSidebarEditor copied to clipboard
Apparent syntax error in code
Just found this and tried a simple add to sidebar based on the sample code you provide (Catalina 10.15.3 (19D76)). Here's what I get:
Traceback (most recent call last):
File "./add_item.py", line 3, in <module>
from FinderSidebarEditor import FinderSidebar # Import the module
File "/Users/kfeuerherm/bin/FinderSidebarEditor/FinderSidebarEditor.py", line 187
comparison_path = f'file://{path}/'.upper()
^
SyntaxError: invalid syntax
I'm not sure whether this has to do with Python version or something else? (Python 3.7.6)
This seems to be an issue with you Python version and f-strings. Are you sure you are running this snippet using 3.7.6? f-strings were introduced in 3.6 in PEP 498.
If you don't want to upgrade your Python and you are just copying code, change the f-string to use format
and it will work.
Another option is to use the library finder-sidebar-editor
that I maintain and wait for me to update it so it uses format
instead of f-strings.
Thanks for this. I just checked, yes, version 3.7.6, odd...
And I have Anaconda, which apparently insists on that version. I did instal 3.8 just now, but not sure how to override for this particular script.
I looked up f-strings; I see, much like Swift strings, new to me. Let me see what I can cook up.
comparison_path = ('file://'+path+'/').upper()
Now: line 28, in
And perhaps there will be more like this?
Apologies for my absence, it's been a crazy year. @kgfeuerherm, do you still need help with anything?
Thanks for checking in @ajordat. It’s been a long while and at the time I asked, I shelved this and worked around it. If I can get it working, it would be nice; I may be able to look at this on the weekend.
On Oct 26, 2021, at 7:18 AM, Ajordat @.***> wrote:
Apologies for my absence, it's been a crazy year. @kgfeuerherm https://github.com/kgfeuerherm, do you still need help with anything?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robperc/FinderSidebarEditor/issues/5#issuecomment-951835007, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO2MYOG66FXK6QCUXLIPIJDUI2MB7ANCNFSM4LJJRAPQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
That would be awesome! If you feel like the package could benefit from your solution, open a PR on the library repo!