Thread: [Pyobjc-dev] newbie questions about PyObjC
Brought to you by:
ronaldoussoren
|
From: Joe S. <jo...@st...> - 2008-10-02 23:44:48
|
I last used Python years ago, but now I'm considering it again. Mac application development is very important to my work, so this led me to PyObjC. But I'm confused on a few points... 1. The 2008-05-27 status update says that it doesn't support 10.4.... yet the "status" area says that PyObjC supports 10.3.9 and later, and I see that PyObjC 2.0 not only supports 10.5, but it's actually included with the OS. So which is it? Is 10.4 supported or not? 2. The "Examples" area of the web site talks about some great-sounding examples... but where do I get them? (They don't seem to match up to the folders in /Developer/Examples/Python/PyObjC/.) 3. How do I run the examples in /Developer/Examples/Python/PyObjC/? None of the folders seem to contain a prebuilt executable, and the "read me" files usually don't make much sense. For example, the one in PyObjC/Cocoa/AppKit/DatePicker directs me to run the "supplied XCode project," but there isn't any. I tried cd'ing to that directory and doing "python main.py", but got: IA-J1:DatePicker> python main.py 2008-10-02 15:38:48.330 Python[12024:613] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting Similar attempts in other directories were also not met with success. (The wxPython examples all worked fine, so I think my stock Python installation is OK.) 4. I tried downloading the PyAverager example from <http://developer.apple.com/cocoa/pyobjc.html >. This included a prebuilt binary that works fine. But when I try to run the XCode project, I get this error: Oct 2 15:41:24 IA-J1 PyAverager[12041]: PyAverager Error\nAn unexpected error has occurred during execution of the main script\n \nNibLoaderError: Superclass 'NibClassBuilder' for 'PyAveragerAppDelegate' not found. How do I fix that? I'm really excited about PyObjC in theory, but so far I haven't had much success with it -- I'm hoping some kind soul here will help me get over these initial hurdles. Thanks, - Joe |
|
From: Joe S. <jo...@st...> - 2008-10-03 14:41:01
|
On Oct 2, 2008, at 6:25 PM, Will Larson wrote: > PyObjC is a bit hairy to get started with. I wrote a handful of > tutorials about a month ago ( http://lethain.com/entry/2008/aug/22/an-epic-introduction-to-pyobjc-and-cocoa/ > ) which should be fairly helpful for getting started. It is, but I've run into a snag, that maybe you or someone else here can help with. At the start of part 2 of the tutorial, you suggest installing "simplejson" with easy-install. I've never even heard of easy-install before, but apparently it didn't work for me: IA-J1:books> sudo easy_install simplejson Password: Searching for simplejson Reading http://pypi.python.org/simple/simplejson/ Reading http://undefined.org/python/#simplejson Best match: simplejson 2.0.1 Downloading http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.1.tar.gz#md5 =ee2d74d695dc63d188fc3d3c6aa0d90a Processing simplejson-2.0.1.tar.gz Running simplejson-2.0.1/setup.py -q bdist_egg --dist-dir /tmp/ easy_install-eXZ5SF/simplejson-2.0.1/egg-dist-tmp-Ct1pY4 No eggs found in /tmp/easy_install-eXZ5SF/simplejson-2.0.1/egg-dist- tmp-Ct1pY4 (setup script problem?) ... IA-J1:MetaWindow> python Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import metaweb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "metaweb.py", line 41, in <module> import simplejson # JSON serialization and parsing ImportError: No module named simplejson Apparently easy_install wanted to find some eggs? I don't know how to make sense of this, or how to fix it. For what it's worth, "locate simplejson" on the command line returns no results. Any tips? Thanks, - Joe |
|
From: Will L. <le...@gm...> - 2008-10-03 14:55:06
|
Hard to say what is wrong with your easy_install setup. Thought it was correctly setup by default in 10.5... either way, you should be able to install simplejson by downloading the package at http://pypi.python.org/pypi/simplejson . Feel free to email me directly off list for any other problems with my work. ;) On Oct 3, 2008, at 10:40 AM, Joe Strout wrote: > On Oct 2, 2008, at 6:25 PM, Will Larson wrote: > >> PyObjC is a bit hairy to get started with. I wrote a handful of >> tutorials about a month ago ( http://lethain.com/entry/2008/aug/22/an-epic-introduction-to-pyobjc-and-cocoa/ >> ) which should be fairly helpful for getting started. > > It is, but I've run into a snag, that maybe you or someone else here > can help with. At the start of part 2 of the tutorial, you suggest > installing "simplejson" with easy-install. I've never even heard of > easy-install before, but apparently it didn't work for me: > > IA-J1:books> sudo easy_install simplejson > Password: > Searching for simplejson > Reading http://pypi.python.org/simple/simplejson/ > Reading http://undefined.org/python/#simplejson > Best match: simplejson 2.0.1 > Downloading http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.1.tar.gz#md5 > =ee2d74d695dc63d188fc3d3c6aa0d90a > Processing simplejson-2.0.1.tar.gz > Running simplejson-2.0.1/setup.py -q bdist_egg --dist-dir /tmp/ > easy_install-eXZ5SF/simplejson-2.0.1/egg-dist-tmp-Ct1pY4 > No eggs found in /tmp/easy_install-eXZ5SF/simplejson-2.0.1/egg-dist- > tmp-Ct1pY4 (setup script problem?) > > ... > IA-J1:MetaWindow> python > Python 2.5.1 (r251:54863, Feb 4 2008, 21:48:13) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import metaweb > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "metaweb.py", line 41, in <module> > import simplejson # JSON serialization and parsing > ImportError: No module named simplejson > > Apparently easy_install wanted to find some eggs? I don't know how > to make sense of this, or how to fix it. For what it's worth, > "locate simplejson" on the command line returns no results. Any tips? > > Thanks, > - Joe > > > |
|
From: Will L. <le...@gm...> - 2008-10-03 00:26:04
|
Joe, PyObjC is a bit hairy to get started with. I wrote a handful of tutorials about a month ago ( http://lethain.com/entry/2008/aug/22/an-epic-introduction-to-pyobjc-and-cocoa/ ) which should be fairly helpful for getting started. As for your specific questions... > > 1. The 2008-05-27 status update says that it doesn't support 10.4.... > yet the "status" area says that PyObjC supports 10.3.9 and later, and > I see that PyObjC 2.0 not only supports 10.5, but it's actually > included with the OS. So which is it? Is 10.4 supported or not? The confusion is that it is talking about two different kinds of support: a) support for deploying applications (using based PyObjC applications), and b) support for developing applications (using PyObjC). The short answer is PyObjC2.0 doesn't support developing on 10.4, but can create applications that run on 10.4. > 2. The "Examples" area of the web site talks about some great-sounding > examples... but where do I get them? (They don't seem to match up to > the folders in /Developer/Examples/Python/PyObjC/.) Do you have XCode fully installed? The paths may not correspond directly, but there are a plethora of examples in the /Developer/ Examples/Python/PyObjC/ folder. Some of them are up to date. > 3. How do I run the examples in /Developer/Examples/Python/PyObjC/? Most of the examples are still based on 1.x PyObjC (anything that mentions NibClassBuilder, for example), which is why they won't run without modification. > 4. I tried downloading the PyAverager example from... Again the issue is that the examples are mostly outdated. The outdated examples is the reason I wrote the aforementioned tutorial, and it assumes no knowledge of PyObjC/Cocoa, so it ought to be a helpful in your case. PyObjC is a bit undersupported at the moment, but is really a fantastic project once you get used to it. Will |
|
From: Joe S. <jo...@st...> - 2008-10-03 02:14:46
|
On Oct 2, 2008, at 6:25 PM, Will Larson wrote: > PyObjC is a bit hairy to get started with. I wrote a handful of > tutorials about a month ago ( http://lethain.com/entry/2008/aug/22/an-epic-introduction-to-pyobjc-and-cocoa/ > ) which should be fairly helpful for getting started. Thanks, Will, that looks really helpful! Best, - Joe |