From j.orponen at 4teamwork.ch Thu Jul 13 09:10:50 2017 From: j.orponen at 4teamwork.ch (Joni Orponen) Date: Thu, 13 Jul 2017 15:10:50 +0200 Subject: [Pythonmac-SIG] Working with ScriptingBridge Message-ID: Hello, I've been following along the SBSendEmail example from Apple. https://developer.apple.com/library/content/samplecode/SBSendEmail/Introduction/Intro.html The same should be able to be done via pyobjc as well. The alloc init cycle of the outgoing message object yields me a Python future object. Example code below: from ScriptingBridge import SBApplication apple_mail = SBApplication.applicationWithBundleIdentifier_( 'com.apple.mail') apple_mail_message_class = apple_mail.classForScriptingClass_( 'outgoing message') apple_mail_message = apple_mail_message_class.alloc().initWithProperties_({ 'subject': 'foo', 'content': 'bar', }) Only alloc()ing the object yields an ephemeral pseudo-SB object as improper SB use does. >>> apple_mail_message = apple_mail_message_class.alloc() >>> apple_mail_message >>> apple_mail_message.subject() >>> apple_mail_message.subject() Traceback (most recent call last): File "", line 1, in AttributeError: cannot access attribute 'subject' of NIL 'MailOutgoingMessage' object >>> apple_mail_message My understanding of what is going here is that interacting with it once makes it go away as its retain count is 0 in the Obj-C VM. The future object contains its properties in its repr(). >>> apple_mail_message >>> type(apple_mail_message) So, how to work with these future objects? Or am I doing something fundamentally wrong in how I'm trying to chase the obj-c example? -- Joni Orponen -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.orponen at 4teamwork.ch Thu Jul 13 11:15:48 2017 From: j.orponen at 4teamwork.ch (Joni Orponen) Date: Thu, 13 Jul 2017 17:15:48 +0200 Subject: [Pythonmac-SIG] Working with ScriptingBridge In-Reply-To: References: Message-ID: To answer myself, one just has to find the correct kind of an NSArray-ish with an .addObject_(foo) which will eat the proxied class instance in question. Just as the docs say. -- Joni Orponen -------------- next part -------------- An HTML attachment was scrubbed... URL: From pitosalas at brandeis.edu Tue Jul 18 15:37:05 2017 From: pitosalas at brandeis.edu (Pito Salas) Date: Tue, 18 Jul 2017 15:37:05 -0400 Subject: [Pythonmac-SIG] Uninstalling Message-ID: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> I?m new to Python. I seem to have three partially installed Pythons on my Mac Sierra. One from Apple One from Homebrew And one from the Python Mac installer In particular, for example, I have a python executable in /usr/bin: $ which python /usr/bin/python This is an actual executable not a symkink. There are a whole bunch of python related files in that directory: python python-config python2.6 python2.6-config python2.7 python2.7-config pythonw pythonw2.6 pythonw2.7 I think they all came from the python.org python installer. I would like to fully uninstall the Python (and related files) that I got from the Mac Python Installer from the python web site. I can?t find up to date instructions. Does anyone know how to do this? Thanks! Pito Salas From jack.jansen at cwi.nl Wed Jul 19 07:48:44 2017 From: jack.jansen at cwi.nl (Jack Jansen) Date: Wed, 19 Jul 2017 13:48:44 +0200 Subject: [Pythonmac-SIG] Uninstalling In-Reply-To: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> References: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> Message-ID: I think the /usr/bin/python executable you?re seeing is the Apple-supplied one. Here?s what I have in /usr/bin, which is all from Apple: $ ls -l /usr/bin/pyth* -rwxr-xr-x 1 root wheel 66576 Apr 29 02:29 /usr/bin/python -rwxr-xr-x 5 root wheel 925 Jul 31 2016 /usr/bin/python-config lrwxr-xr-x 1 root wheel 75 Jun 22 13:26 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 lrwxr-xr-x 1 root wheel 82 Jun 22 13:26 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config lrwxr-xr-x 1 root wheel 75 Jun 22 13:26 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 lrwxr-xr-x 1 root wheel 82 Jun 22 13:26 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config -rwxr-xr-x 1 root wheel 66576 Apr 29 02:30 /usr/bin/pythonw lrwxr-xr-x 1 root wheel 76 Jun 22 13:26 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6 lrwxr-xr-x 1 root wheel 76 Jun 22 13:26 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7 $ Homebrew puts everything in /usr/local/bin, and I think so does the official Python Mac installer (it did when I was still responsible for it:-). > On 18 Jul 2017, at 21:37, Pito Salas wrote: > > I?m new to Python. I seem to have three partially installed Pythons on my Mac Sierra. > > One from Apple > One from Homebrew > And one from the Python Mac installer > > In particular, for example, I have a python executable in /usr/bin: > > $ which python > /usr/bin/python > > This is an actual executable not a symkink. There are a whole bunch of python related files in that directory: > > python python-config python2.6 python2.6-config python2.7 python2.7-config pythonw pythonw2.6 pythonw2.7 > > > I think they all came from the python.org python installer. > > I would like to fully uninstall the Python (and related files) that I got from the Mac Python Installer from the python web site. I can?t find up to date instructions. > > Does anyone know how to do this? Thanks! > > Pito Salas > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > https://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From piet-l at vanoostrum.org Thu Jul 20 06:24:39 2017 From: piet-l at vanoostrum.org (Piet van Oostrum) Date: Thu, 20 Jul 2017 12:24:39 +0200 Subject: [Pythonmac-SIG] Uninstalling In-Reply-To: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> (Pito Salas's message of "Tue, 18 Jul 2017 15:37:05 -0400") References: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> Message-ID: Pito Salas writes: > I?m new to Python. I seem to have three partially installed Pythons on my Mac Sierra. > > One from Apple > One from Homebrew > And one from the Python Mac installer > > In particular, for example, I have a python executable in /usr/bin: > > $ which python > /usr/bin/python > > This is an actual executable not a symkink. There are a whole bunch of > python related files in that directory: > > python python-config python2.6 python2.6-config python2.7 > python2.7-config pythonw pythonw2.6 pythonw2.7 > Normally you should never touch anything in /usr/bin or /usr/lib. That is Apple territory. > > I think they all came from the python.org python installer. If it is in /usr/bin, it shouldn't. > > I would like to fully uninstall the Python (and related files) that I > got from the Mac Python Installer from the python web site. I can?t find > up to date instructions. > > Does anyone know how to do this? Thanks! > Delete /Library/Frameworks/Python.framework/ and all links in /usr/local/bin and /usr/local/lib that point towards something inside that directory. On the other hand, I find it very useful to have a Python from python.org installed as they are usually more up to date than the Apple supplied one. If you tell the installer to install the links in /usr/local, and put /usr/local/bin in your PATH before /usr/bin, you will use these, and Apple will still use their own version. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] From glyph at twistedmatrix.com Fri Jul 21 04:22:29 2017 From: glyph at twistedmatrix.com (Glyph) Date: Fri, 21 Jul 2017 01:22:29 -0700 Subject: [Pythonmac-SIG] Uninstalling In-Reply-To: References: <3DF47145-D2AB-4FE0-8DF9-E45B8AACF3AC@brandeis.edu> Message-ID: > On Jul 20, 2017, at 3:24 AM, Piet van Oostrum wrote: > > Normally you should never touch anything in /usr/bin or /usr/lib. That is Apple territory. You can't any more. $ touch /usr/bin/just-testing touch: /usr/bin/just-testing: Operation not permitted $ sudo touch /usr/bin/just-testing Password: touch: /usr/bin/just-testing: Operation not permitted Since System Integrity Protection came out with El Capitan, unless you reboot into recovery mode and type some "void your warranty" commands into the terminal app on the recovery partition, it's simply no longer possible for 3rd-party applications and installers to write files into /usr/bin. Attempting to install over /usr/bin/python on any macOS released in the last 2 years will just fail. -glyph -------------- next part -------------- An HTML attachment was scrubbed... URL: