change an alias target python

2019-04-12 22:54发布

问题:

I would like to change the target of an alias using python. do I have to download some external library to do this. I played around with aliases a bit and can't figure out any way to edit them without user input.

I'm using mac, python 2.6

回答1:

As far as I can tell it should be possible using PyObjC to get at the Mac's Foundation library. I think NSURLBookmarkResolutionWithoutUI is what you are looking for.



回答2:

PyObjC was a good suggestion. I couldn't find a solution anywhere, but after asking an equivalent question, finally managed to create one. See my answer to my own question: how to read, change, and write macOS file alias from python