Open fseesink opened 1 year ago
You’ll need to use another Python 3.. as the Apple Python 3 has issues with the ObjC binding.
Maybe try the macadmins python.
On Mon, 13 Feb 2023 at 22:49, Frank Seesink @.***> wrote:
Looking through other issues, guessing this isn't new per se. Looks like this all began as a Python v2 script that's been brought to v3 but still tied to some older modules.
For reference my system:
- 2019 27" iMac with Core i5 and 32GB RAM
- macOS 13.2
- Python.org's Python 3.11.2
- Command Line Tools for Xcode 14.2
Did a git clone of repo. First attempt to run script:
% ./mcxToProfile.py
zsh: ./mcxToProfile.py: bad interpreter: /usr/bin/python: no such file or directory
Looking at file, I see top line shows #!/usr/bin/python. Yeah, that's not gonna work. Modified it to #!/usr/bin/python3 and re-ran script. Now I get
% ./mcxToProfile.py
Traceback (most recent call last):
File "/Users/frank/Desktop/mcxToProfile/./mcxToProfile.py", line 15, in
from Foundation import NSData, \
ModuleNotFoundError: No module named 'Foundation'
I did some digging and seems that the underbelly of this relies on something called PyObjC. I tried installing it after finding it on PyPi.org, but pip install pyobjc failed miserably.
Found the source code for that here: https://github.com/ronaldoussoren/pyobjc
So cloned it into the directory where I had this script. I setup a virtual environ using virtualenv venv followed by source venv/bin/activate, so I can sandbox this setup somewhat.
At that point I followed the instructions and tried to do python3 pyobjc/install.py but that failed due to not being able to import _install_tool. I moved down into ./pyobjc and re-ran it as python3 install.py, and THAT seemed to do the trick. Got lots of warnings/etc., but it spent the next 20+ minutes compiling. Sadly, that ended badly with
...
^ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pyobjc-framework-WebKit
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Installing 'pyobjc-framework-WebKit' failed (status 1)
Cannot build one of the projects, bailing out
So still can't run this.
Anyway, so looks like this "Foundation" module isn't installed, nor can I get the bits going to do so.
If I had to guess, this script relies on features not found on stock macOS systems. Is that a fair assessment? If there are dependencies, might it not help to articulate them in the README.md file so users have a better chance of using this tool? It feels like this could do with a requirements.txt or similar file to let folks know what is expected.
I came here as I was dealing with a Munki issue and multiple references mentioned this particular tool. Sadly looks like it's not quite as simple to use as they made it sound.
— Reply to this email directly, view it on GitHub https://github.com/timsutton/mcxToProfile/issues/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASZZTXMUW6GVUECGDKOLR3WXK26BANCNFSM6AAAAAAU23AF24 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
--
Regards,
Ben
I am on macOS Monterey 12.6.3 und have already updated my python to the latest version(3.11.2). But I still get the following error:
Traceback (most recent call last):
File "/Users/taayame4/Desktop/mcxToProfile.py", line 15, in
How do I get any other python3 if not Apple's python3? Sorry, dont have much experience with the python
I had to change the shebang from #!/usr/bin/env python
to #!/usr/bin/env python3
and make sure to install python@3 from Homebrew — and I think pip install pyobjc
to be able to import the Foundation module.
Looking through other issues, guessing this isn't new per se. Looks like this all began as a Python v2 script that's been brought to v3 but still tied to some older modules.
For reference my system:
Did a
git clone
of repo. First attempt to run script:Looking at file, I see top line shows
#!/usr/bin/python
. Yeah, that's not gonna work. Modified it to#!/usr/bin/python3
and re-ran script. Now I getI did some digging and seems that the underbelly of this relies on something called PyObjC. I tried installing it after finding it on PyPi.org, but
pip install pyobjc
failed miserably.Found the source code for that here: https://github.com/ronaldoussoren/pyobjc
So cloned it into the directory where I had this script. I setup a virtual environ using
virtualenv venv
followed bysource venv/bin/activate
, so I can sandbox this setup somewhat.At that point I followed the instructions and tried to do
python3 pyobjc/install.py
but that failed due to not being able toimport _install_tool
. I moved down into./pyobjc
and re-ran it aspython3 install.py
, and THAT seemed to do the trick. Got lots of warnings/etc., but it spent the next 20+ minutes compiling. Sadly, that ended badly withSo still can't run this.
Anyway, so looks like this "Foundation" module isn't installed, nor can I get the bits going to do so.
If I had to guess, this script relies on features not found on stock macOS systems. Is that a fair assessment? If there are dependencies, might it not help to articulate them in the README.md file so users have a better chance of using this tool? It feels like this could do with a
requirements.txt
or similar file to let folks know what is expected.I came here as I was dealing with a Munki issue and multiple references mentioned this particular tool. Sadly looks like it's not quite as simple to use as they made it sound.