ImportError: No module named Cocoa

1,311 views
Skip to first unread message

wolframite

unread,
Dec 22, 2010, 4:52:24 PM12/22/10
to PyMacAdmin
I may be over my head, so please be gentle if this is a stupid
question.

I am trying to run crankd.py and get the following message when I try
to run the script in terminal:


media09:sbin ncabiac$ python crankd.py
Traceback (most recent call last):
File "crankd.py", line 23, in <module>
from Cocoa import \
ImportError: No module named Cocoa

Can anyone help me to understand what I am doing wrong? Thank you :)

Greg Neagle

unread,
Dec 22, 2010, 6:36:12 PM12/22/10
to pymac...@googlegroups.com
You are either not running on a Mac, or you are using a non-default-Apple-installed version of Python that doesn't have pyobjc bindings or you are running on an old OS (pre-10.4?) that doesn't have pyobjc bindings.

Type:
uname -a
which python

So we can get some more data points...

-Greg

wolframite

unread,
Dec 22, 2010, 9:40:39 PM12/22/10
to PyMacAdmin
Thanks for the help! This is what I get when I type uname -a

Darwin ncabiac.local 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov 5
23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386

I am running python 2 (2.6.6).

Here are some more specs if it helps:

MacBook running OS X 10.6.5
Processor 2 GHz Intel Core 2 Duo
2GB SDRAM

Karl Kuehn

unread,
Dec 22, 2010, 9:49:27 PM12/22/10
to pymac...@googlegroups.com
On Dec 22, 2010, at 6:40 PM, wolframite wrote:

> On Dec 22, 6:36 pm, Greg Neagle <gregnea...@mac.com> wrote:
>> You are either not running on a Mac, or you are using a non-default-Apple-installed version of Python that doesn't have pyobjc bindings or you are running on an old OS (pre-10.4?) that doesn't have pyobjc bindings.
>

> I am running python 2 (2.6.6).
>

> MacBook running OS X 10.6.5


The version of Python that ships from Apple is 2.6.1, so Greg's guess that you are using a non-standard version of Python was the correct one. You need to use the standard one installed by Apple, anything else is not going to have the pyobjc extensions.

--
Karl Kuehn
lar...@softhome.net


wolframite

unread,
Dec 22, 2010, 10:34:09 PM12/22/10
to PyMacAdmin
Thank you very much Greg and Karl, I am no longer getting that error,
much much appreciated!
>                 lark...@softhome.net
Reply all
Reply to author
Forward
0 new messages