univ-of-utah-marriott-library-apple / display_manager

An open-source Python library which can modify your Mac's display settings manually or automatically.
MIT License
237 stars 18 forks source link

macOS 12.3 removes python 2.7 #25

Open ptrkstr opened 2 years ago

ptrkstr commented 2 years ago

Source: https://macmule.com/2022/01/29/macos-monterey-12-3-will-remove-python-2-7-usr-bin-python/

Given that python 2.7 will no longer be part of the system from that release onwards, the following error will appear:

/usr/local/bin/display_manager.py: bad interpreter: /usr/bin/python: no such file or directory

As a workaround, is it possible to specify the location of python 2.7 to use?

whyisjake commented 2 years ago

This is useful: https://stackoverflow.com/a/67274521

uurazzle commented 2 years ago

Hi @ptrkstr:

Thanks for the feedback and opening an issue. But, TBH, our team is very busy with other projects and we will need dedicate time, attention & testing to the migration of the display_manager script to python 3.

Will will keep adding it to our to-do's and get to it as soon as we are able.

In the interim, you can implement @whyisjake suggestion to install python 2.7 or use other options like relocatable-python: A tool for building standalone relocatable Python.framework bundles.

talving commented 2 years ago

Hi, having the same issue here. Tried @whyisjake's approach but can't seem to get it to work. Could you please add some instructions on how to get this to work again?

ptrkstr commented 2 years ago

Hi @ptrkstr:

Thanks for the feedback and opening an issue. But, TBH, our team is very busy with other projects and we will need dedicate time, attention & testing to the migration of the display_manager script to python 3.

Will will keep adding it to our to-do's and get to it as soon as we are able.

In the interim, you can implement @whyisjake suggestion to install python 2.7 or use other options like relocatable-python: A tool for building standalone relocatable Python.framework bundles.

Hi @uurazzle, that workaround looks good, I appreciate the reply 🙏

talving commented 2 years ago

Hi!

Tried the relocatable-python workaround but am still getting errors. Any ideas?

thta@m1air-01 ~ % /usr/local/bin/display_manager.py help Traceback (most recent call last): File "/usr/local/bin/display_manager.py", line 27, in <module> from display_manager_lib import * # The Display Manager Library File "/usr/local/bin/display_manager_lib.py", line 27, in <module> import objc # access Objective-C functions and variables ModuleNotFoundError: No module named 'objc'

Tried manually installing objc but can't seem to get it to work.

filipruisl commented 2 years ago

hi folks, is there an update somewhere on horizon that wouldn't need to require the workaround?

uurazzle commented 2 years ago

Hi, @filipruisl:

Sorry, we haven't had the bandwidth to focus on this project, but it is on our to-do's when we have time and can fit it into our priorities.

jazzace commented 1 year ago

Looks like the code has been update for Python3 (much appreciated!). However, the ReadMe file still references Python 2.7.

afcollins commented 1 year ago

It seems the interpreter location and the install location of the lib is incorrect for this Ventura.

I was able to get this running on MacOS 13.2 from the installer without relocatable python by:

1) Installing Python 2.7 from python.org installer. 2) Change the interpreter (first line) of /usr/local/bin/display_manager.py and /Library/Python/2.7/site-packages/display_manager_lib.py to #!/usr/local/bin/python2.7 3) cp /Library/Python/2.7/site-packages/display_manager_lib.py /Library/Frameworks/Python.framework/Versions/2.7/lib/ 4) pip2.7 install pyobjc

It worked after that. May need 'sudo' to copy to those dirs.

sureshkumar-skc commented 1 year ago

@uurazzle I can see the code has been updated to python3. Can you guide to use it with python3?