robperc / FinderSidebarEditor

Python module for programmatically editing the Favorites entries of the Finder sidebar
71 stars 9 forks source link

How to use it? #8

Open bezik46 opened 3 years ago

bezik46 commented 3 years ago

Trying recommended:

https://github.com/Ajordat/finder-sidebar-editor

but only getting an error:

seb@imac finder-sidebar-editor-master % python3 setup.py
Traceback (most recent call last):
  File "/Users/seb@imac/Downloads/finder-sidebar-editor-master/setup.py", line 3, in <module>
    from finder_sidebar_editor import __version__
  File "/Users/seb@imac/Downloads/finder-sidebar-editor-master/finder_sidebar_editor/__init__.py", line 1, in <module>
    from .FinderSidebarEditor import FinderSidebar
  File "/Users/seb@imac/Downloads/finder-sidebar-editor-master/finder_sidebar_editor/FinderSidebarEditor.py", line 3, in <module>
    from Cocoa import NSURL
ModuleNotFoundError: No module named 'Cocoa'
Ajordat commented 3 years ago

Hi @scerazy, could you provide more details on what you did? It looks like you cloned the library repository and attempted to run the setup.py file. What are you trying to achieve exactly?

If you just want to install it to use it on your project, you should use the PyPI package: pip install finder-sidebar-editor After that you'll be able to use the package as noted in the README.md file.

On a side note, the package is maintained in Ajordat/finder-sidebar-editor, so feel free to report any other issues in that one!

bezik46 commented 3 years ago

Over there there is no Issues button. All I need is to try to add a folder to Sidebar, preferably scripted, executed by MDM

Ajordat commented 3 years ago

My bad, I have allowed it now and you should be able to do so.

I'm not sure what MDM is, but if you can run python and it's a MacOS you should be able to install the library in there and make us of it as seen on the README.md.

bezik46 commented 3 years ago

Mobile Device Management

It does works when executed by hand in Python3.

I really have no idea how to script it with variables (for Onedrive Documents/Desktop location)

Ajordat commented 3 years ago

I find it weird that it works when run in the Python CLI but not on the app. Are you using any virtual environment? That would be an explanation for the different results: they are run in different environments with different dependencies/requirements.

I'm not sure what you mean with the variables thing.

bezik46 commented 3 years ago

I do not know what app you mean, because I can only see the CLI Python module... How about script python script to run something like that

sidebar.add("/Users/Logged-in-User-that-runs the script/Some path to OneDrive's Installation/Documents")