Tag Info

Hot answers tagged

30

I'm assuming the paths to the python script and its parameters are valid, otherwise you'd most likely be seeing errors in the Console instead. The last time I saw that error was because there were spurious characters in the plist, e.g. extra spaces, causing syntax errors and therefore making it fail to load. If you run plutil -lint on your plist, this will ...


11

Preferences are cached in 10.9. See http://hints.macworld.com/article.php?story=20130908042828630. If you edit a plist file directly or replace the plist of an application, the application will keep using the cached version even after you quit and reopen the application. You can run defaults read com.googlecode.iterm2 or killall cfprefsd to apply the ...


10

I think that pwd -P and readlink are going to be your friends for this task. "How can I get the behavior of GNU's readlink -f on a Mac?" is a handy resource. pwd -P only works if you're inside the symlink directory: 14:07:13 jason@mac ~ $ cd bin 14:08:08 jason@mac bin $ pwd -P /Users/jason/Applications readlink works by specifying the target (thus it ...


9

If an application has open windows, this should raise them above windows from other applications, but keep them below ones from the current application. tell application "System Events" perform action "AXRaise" of window 1 of process "QuickTime Player" end tell


8

Macports select can change it back. The current macports does it using the port select command - older versions had python_select To see the possible pythons run port select --list python From that list choose the one you want and change to it e.g. sudo port select --set python python25-apple


8

To fix this problem you need to download the Command Line Tools for Mountain Lion. Currently you still need a Mac OS X developers subscription to get the release version of these, this should change to in the next day or so. EDIT: You can now install the release version of the Command Line Tools using Xcode with a free developer account. For those of you ...


7

You can install 2.7. It is generally considered a bad, bad idea to change the native version, because built-in apps and frameworks are written for specifically the version that is bundled. The way to go is to install 2.7 along side 2.6. This is generally considered the best practice. That way, you can use 2.7 when you want, and apps will still use the ...


7

It's on 2.7.5. Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>


6

This resolves recursively and returns an absolute path: $ python >>> import os >>> os.path.realpath("/usr/local/bin/python3") Or the non-interactive version: python -c "import os; print os.path.realpath('/usr/local/bin/python3')"


6

You need an alias. Typing alias sage='open /PATH/TO/Sage.app' will create an alias which will do exactly what you want, run the program just by typing sage. The problem is that this will only last until you close that terminal window (bash). So, you need to create that alias each time you run a new bash. To do so, just: Create or modify a text file called ...


5

PIL is missing libjpeg library. To install it: Go to http://www.ijg.org/files/jpegsrc.v8c.tar.gz Unpack this package and cd to the unpacked folder cd ~/Downloads/jpeg-8c Compile it: ./configure make Then install: sudo make install But PIL still can't find library. Now you need to reinstall it: Uninstall pil (if you instlled it with pip, just type ...


5

/Library/Python/x.x/site-packages (x.x designates the version).


5

You need to install Xcode 4.4 (from the app store) and then, within xcode open Xcode > Preferences (or press Cmd + ,) then open the downloads tab and install the Command Line Tools.


5

While checking the programs above I realized I hadn't added the Current alias, which was likely used: /System/Library/Frameworks/Python.framework/Versions/Current/Python Adding Python from the Current alias folder fixed my problem. Hadn't seen this question or answer anywhere else online so I'm keeping it up.


5

There are several ways to install Python and which way affects the later answers. In all cases you should install a later Python 3 version - 3.1.3 is the latest released version. For choosing which to run I would call python3.1 or python2.6 to be explicit as the language differs enough that the code is specific to the 2.x or 3.x branches. In fact much code ...


4

I just don't believe that thing that you want yet exists1. But… 1) There is textastic which supports text highlighting for Python, Ruby, CSS and HTML and it supports FTP, SFTP and WebDAV connectivity (but no version control support). It highlights 80 different file formats but not Django templates (you can edit them like it's just html). 2) GitHub ...


4

I coul not install pygit2 using pip. However, it worked fine using the latest version available on Github: $ git clone git://github.com/libgit2/pygit2.git $ cd pygit2 $ python setup.py install The problem here I think is that you're trying to use a two month old pygit2 release with the cutting edge version of libgit2. If using pip is an absolute ...


4

Instead of using Finder aliases, use Terminal to create symbolic links (see man ls for details): ln -s /path/to/python3.3/binary /usr/local/bin/python ln -s /path/to/python2.6/binary /usr/local/bin/python2.6 It's usually not a good idea to mess with /usr/bin content (will be wiped out with the next upgrade). Use /usr/local/bin instead and make sure it ...


4

You can use a service created by Automator to call your python script. Once your service is created, it will be available in the service submenu of your contextual menu.


3

My MBA, which has been incrementally upgraded from 10.7, contains the following versions of Python: Python 2.5.6 (r256:Unversioned directory, Aug 25 2013, 00:03:43) Python 2.6.8 (unknown, Aug 25 2013, 00:04:29) Python 2.7.5 (default, Aug 25 2013, 00:04:04) Being that they have the same build date it would appear that all versions of Python have been ...


3

The default behavior when receiving SIGQUIT is to dump core and exit; the crash reporter is triggered as a part of this process. Starting with 10.5(?) simply setting a signal handler for SIGQUIT should be sufficient to avoid the crash reporter; you will probably want the handler to also call exit. import signal, sys, os def sigquit_handler(signum, frame): ...


3

According to StackOverflow you just can type python -c "help('modules')" or pip freeze


3

In terminal: while :; do ./script_name; done or while :; do python programm.py; done If you want add some sleep time before run program again use 'sleep' command: For example: while :; do python programm.py; sleep 90; done in this example cycle will sleep 90 second before run again you program


3

My favorite editor for writing any scripting language, not just Python but Ruby, perl, etc… is Textmate. Since I do this for a living I am still using TextMate version 1 that I paid for ages ago. Textmate version 2 is now open source software and as such is free to download and even change. Both versions can be downloaded from the Macromates Download page. ...


3

At the moment this isn't likely to be fixable, unless you're fairly comfortable with OS X development and want to rewrite parts of the underlying GUI library. According to this bug report on Python.org, it's an issue with the TkInter GUI library, which IDLE apparently makes use of. TkInter in turn is based on Tk, which is a cross-platform GUI toolkit, which ...


3

You need to create a shell script named sage containing: #!/bin/bash open /Applications/Sage.app I suggest creating a bin directory in your home folder, and storing any scripts you create there. Save the script there with the name sage, then execute chmod u+x sage to give your user permission to execute the script. Now, the last step is to tell bash that ...


3

I guess you may either restore from your Time Machine backup, or copy it back from another Mac running the same 10.7.2


3

These are the Python bindings for X11. More info can be found in the X11 Documentation.


3

For me, after installing the command-line tools, easy_install is in /usr/bin, not /usr/local/bin. I needed to remove easy_install from /usr/local/bin: $ sudo rm /usr/local/bin/easy_install* which removes (in my case) easy_install, easy_install-2.6, and easy_install-2.7



Only top voted, non community-wiki answers of a minimum length are eligible