Thread: [Pyobjc-dev] Help getting Started with PyObjc2 and Leopard
Brought to you by:
ronaldoussoren
|
From: George A. <ar...@gm...> - 2007-11-29 14:13:08
|
Hello,
This is my first attempt at using pyobjc and I run into some problems.
I created a new project using XCode 3.0 with the Cocoa-Python
Application template.
I then proceeded to do a build on the application (n.b. I haven't added
any of my own code yet) and the build succeeded.
When I do a build and run however, I get the following error message in
console:
//--------------------------------------------------------------------------------------------------------------------------------
The Debugger Debugger is attaching to process
[Session started at 2007-11-29 08:32:29 -0500.]
Traceback (most recent call last):
File
"/Users/Armahg/Builds/Release/again.app/Contents/Resources/main.py",
line 10, in <module>
import objc
ImportError: No module named objc
2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'/Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with file
'/Users/Armahg/Builds/Release/again.app/Contents/Resources/main.py'.
See console for errors.'
2007-11-29 08:32:29.352 again[2542:10b] Stack: (
2488480363,
2511437979,
2488479819,
2488479882
)
//--------------------------------------------------------------------------------------------------------------------------------
>From what I have read, i thought pyobjC2 should work right out of the
box with Leopard. Is there anything configuration I have to do to get
the app working?
I also tried to run some of the PyObjc examples and received the
following error message
//--------------------------------------------------------------------------------------------------------------------------------
Armahg:CurrencyConverter Armahg$ python setup.py py2app
Traceback (most recent call last):
File "setup.py", line 8, in <module>
import py2app
ImportError: No module named py2app
//--------------------------------------------------------------------------------------------------------------------------------
TroubleShooting done so far:
My current path for Python is:
Armahg$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python
I modified the main.m file in my test PyObjc app to read
/*Py_SetProgramName("/usr/bin/python");*/
Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/Current/bin/python");
and this has not helped either.
Any help given would be much appreciated. Also, in return, I'll document
what I do and post it somewhere online so that
other newcomers won't have to email this dev list with the same problem
again :)
Thanks in advance ,
George.
|
|
From: George A. <ar...@la...> - 2007-11-29 14:05:04
|
Hello,
This is my first attempt at using pyobjc and I run into some problems.
I created a new project using XCode 3.0 with the Cocoa-Python
Application template.
I then proceeded to do a build on the application (n.b. I haven't added
any of my own code yet) and the build succeeded.
When I do a build and run however, I get the following error message in
console:
//--------------------------------------------------------------------------------------------------------------------------------
The Debugger Debugger is attaching to process
[Session started at 2007-11-29 08:32:29 -0500.]
Traceback (most recent call last):
File
"/Users/Armahg/Builds/Release/again.app/Contents/Resources/main.py",
line 10, in <module>
import objc
ImportError: No module named objc
2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'/Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with file
'/Users/Armahg/Builds/Release/again.app/Contents/Resources/main.py'.
See console for errors.'
2007-11-29 08:32:29.352 again[2542:10b] Stack: (
2488480363,
2511437979,
2488479819,
2488479882
)
//--------------------------------------------------------------------------------------------------------------------------------
From what I have read, i thought pyobjC2 should work right out of the
box with Leopard. Is there anything configuration I have to do to get
the app working?
I also tried to run some of the PyObjc examples and received the
following error message
//--------------------------------------------------------------------------------------------------------------------------------
Armahg:CurrencyConverter Armahg$ python setup.py py2app
Traceback (most recent call last):
File "setup.py", line 8, in <module>
import py2app
ImportError: No module named py2app
//--------------------------------------------------------------------------------------------------------------------------------
TroubleShooting done so far:
My current path for Python is:
Armahg$ which python
/Library/Frameworks/Python.framework/Versions/Current/bin/python
I modified the main.m file in my test PyObjc app to read
/*Py_SetProgramName("/usr/bin/python");*/
Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/Current/bin/python");
and this has not helped either.
Any help given would be much appreciated. Also, in return, I'll document
what I do and post it somewhere online so that
other newcomers won't have to email this dev list with the same problem
again :)
Thanks in advance ,
George.
|
|
From: Bill B. <bb...@ma...> - 2007-12-31 17:52:06
|
More likely than not, you have some other version of Python installed
on your system and parts of it are being picked up instead of the
System python.
On Nov 29, 2007, at 6:04 AM, George Armah wrote:
> Hello,
>
> This is my first attempt at using pyobjc and I run into some problems.
>
> I created a new project using XCode 3.0 with the Cocoa-Python
> Application template.
> I then proceeded to do a build on the application (n.b. I haven't
> added any of my own code yet) and the build succeeded.
> When I do a build and run however, I get the following error message
> in console:
>
> //--------------------------------------------------------------------------------------------------------------------------------
> The Debugger Debugger is attaching to process
> [Session started at 2007-11-29 08:32:29 -0500.]
> Traceback (most recent call last):
> File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py", line 10, in <module>
> import objc
> ImportError: No module named objc
> 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
> uncaught exception 'NSInternalInconsistencyException', reason: '/
> Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with
> file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py'. See console for errors.'
> 2007-11-29 08:32:29.352 again[2542:10b] Stack: (
> 2488480363,
> 2511437979,
> 2488479819,
> 2488479882
> )
> //--------------------------------------------------------------------------------------------------------------------------------
> >From what I have read, i thought pyobjC2 should work right out of
> the box with Leopard. Is there anything configuration I have to do
> to get the app working?
>
>
> I also tried to run some of the PyObjc examples and received the
> following error message
>
> //--------------------------------------------------------------------------------------------------------------------------------
> Armahg:CurrencyConverter Armahg$ python setup.py py2app
> Traceback (most recent call last):
> File "setup.py", line 8, in <module>
> import py2app
> ImportError: No module named py2app
> //--------------------------------------------------------------------------------------------------------------------------------
>
> TroubleShooting done so far:
>
> My current path for Python is:
> Armahg$ which python
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> I modified the main.m file in my test PyObjc app to read
> /*Py_SetProgramName("/usr/bin/python");*/
> Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/
> Current/bin/python");
>
> and this has not helped either.
>
>
> Any help given would be much appreciated. Also, in return, I'll
> document what I do and post it somewhere online so that
> other newcomers won't have to email this dev list with the same
> problem again :)
>
> Thanks in advance ,
>
> George.
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: Koen B. <ko...@ma...> - 2007-12-31 11:25:43
|
Dear George,
Could you try to load objc in the interactive console:
Doerak:~ koen$ python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import objc
>>>
If that indeed does work, I suspect your files have a path to the
wrong python on top. That would be the first line in a file like this:
#!/bin/python.
Koen
On 29 nov 2007, at 15:04, George Armah wrote:
> Hello,
>
> This is my first attempt at using pyobjc and I run into some problems.
>
> I created a new project using XCode 3.0 with the Cocoa-Python
> Application template.
> I then proceeded to do a build on the application (n.b. I haven't
> added any of my own code yet) and the build succeeded.
> When I do a build and run however, I get the following error message
> in console:
>
> //--------------------------------------------------------------------------------------------------------------------------------
> The Debugger Debugger is attaching to process
> [Session started at 2007-11-29 08:32:29 -0500.]
> Traceback (most recent call last):
> File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py", line 10, in <module>
> import objc
> ImportError: No module named objc
> 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
> uncaught exception 'NSInternalInconsistencyException', reason: '/
> Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with
> file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py'. See console for errors.'
> 2007-11-29 08:32:29.352 again[2542:10b] Stack: (
> 2488480363,
> 2511437979,
> 2488479819,
> 2488479882
> )
> //--------------------------------------------------------------------------------------------------------------------------------
> >From what I have read, i thought pyobjC2 should work right out of
> the box with Leopard. Is there anything configuration I have to do
> to get the app working?
>
>
> I also tried to run some of the PyObjc examples and received the
> following error message
>
> //--------------------------------------------------------------------------------------------------------------------------------
> Armahg:CurrencyConverter Armahg$ python setup.py py2app
> Traceback (most recent call last):
> File "setup.py", line 8, in <module>
> import py2app
> ImportError: No module named py2app
> //--------------------------------------------------------------------------------------------------------------------------------
>
> TroubleShooting done so far:
>
> My current path for Python is:
> Armahg$ which python
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> I modified the main.m file in my test PyObjc app to read
> /*Py_SetProgramName("/usr/bin/python");*/
> Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/
> Current/bin/python");
>
> and this has not helped either.
>
>
> Any help given would be much appreciated. Also, in return, I'll
> document what I do and post it somewhere online so that
> other newcomers won't have to email this dev list with the same
> problem again :)
>
> Thanks in advance ,
>
> George.
|
|
From: Ronald O. <ron...@ma...> - 2007-11-29 14:53:07
Attachments:
smime.p7s
|
On 29 Nov, 2007, at 15:13, George Armah wrote:
> Hello,
>
> This is my first attempt at using pyobjc and I run into some problems.
The problem you're having is that you have a python framework in /
Library/Frameworks. The easiest way to fix your problems is to remove
that framework (or move it aside if you want to check which site-
packages need to be reinstalled).
The system install of python is 2.5.1 + dtrace support and there is
therefore no need to install a python framework in /Library/
Frameworks. Well, at least not unless you want to build
redistributable applications for OSX 10.4 using py2app.
Ronald
>
>
> I created a new project using XCode 3.0 with the Cocoa-Python
> Application template.
> I then proceeded to do a build on the application (n.b. I haven't
> added any of my own code yet) and the build succeeded.
> When I do a build and run however, I get the following error message
> in console:
>
> //--------------------------------------------------------------------------------------------------------------------------------
> The Debugger Debugger is attaching to process
> [Session started at 2007-11-29 08:32:29 -0500.]
> Traceback (most recent call last):
> File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py", line 10, in <module>
> import objc
> ImportError: No module named objc
> 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to
> uncaught exception 'NSInternalInconsistencyException', reason: '/
> Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with
> file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/
> main.py'. See console for errors.'
> 2007-11-29 08:32:29.352 again[2542:10b] Stack: (
> 2488480363,
> 2511437979,
> 2488479819,
> 2488479882
> )
> //--------------------------------------------------------------------------------------------------------------------------------
> >From what I have read, i thought pyobjC2 should work right out of
> the box with Leopard. Is there anything configuration I have to do
> to get the app working?
>
>
> I also tried to run some of the PyObjc examples and received the
> following error message
>
> //--------------------------------------------------------------------------------------------------------------------------------
> Armahg:CurrencyConverter Armahg$ python setup.py py2app
> Traceback (most recent call last):
> File "setup.py", line 8, in <module>
> import py2app
> ImportError: No module named py2app
> //--------------------------------------------------------------------------------------------------------------------------------
>
> TroubleShooting done so far:
>
> My current path for Python is:
> Armahg$ which python
> /Library/Frameworks/Python.framework/Versions/Current/bin/python
>
> I modified the main.m file in my test PyObjc app to read
> /*Py_SetProgramName("/usr/bin/python");*/
> Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/
> Current/bin/python");
>
> and this has not helped either.
>
>
> Any help given would be much appreciated. Also, in return, I'll
> document what I do and post it somewhere online so that
> other newcomers won't have to email this dev list with the same
> problem again :)
>
> Thanks in advance ,
>
> George.
>
>
>
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell. From the desktop to the data center, Linux is going
> mainstream. Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4_______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|
|
From: Barry W. <bar...@gm...> - 2007-11-29 16:35:24
|
So is it the official stand now that users should install new/updated packages in the system python? My understanding (well, from Tiger days) was that the system's python should not be modified since system services depend on it. This seems to be the unstated rule with Leopard, since the system python puts its own setuptools, numpy etc. packages in sys.path before /Library/Python/2.5/site-packages. So, if we don't install a framework build of Python, it looks like we either have to interfere with system dependencies (such as numpy, setuptools, pyobjc2?, etc.) or be stuck with the version that shipped in Leopard (numpy 1.0.4 is now available, for example). Unfortunately, pyobjc2 won't work with the pyhton.org framework build because the framework build was built using the 10.4u.sdk (see a previous post by me on this subject). However, it's not hard to build a framework build from the python.org source (there's a script that does just that in the source tree). Once python is built with the 10.5.sdk, pyobjc2 compiles and works just fine (we've been using it in production for a few days already). I'm not sure how to compile in dtrace support, but if you can live without that, everything else appears to work. Does anyone know how to add dtrace support to Python or does it require Apple's patches to the interpreter? Perhaps someone from Apple would be willing to comment... Thanks, Barry On 11/29/07, Ronald Oussoren <ron...@ma...> wrote: > > On 29 Nov, 2007, at 15:13, George Armah wrote: > > > Hello, > > > > This is my first attempt at using pyobjc and I run into some problems. > > The problem you're having is that you have a python framework in / > Library/Frameworks. The easiest way to fix your problems is to remove > that framework (or move it aside if you want to check which site- > packages need to be reinstalled). > > The system install of python is 2.5.1 + dtrace support and there is > therefore no need to install a python framework in /Library/ > Frameworks. Well, at least not unless you want to build > redistributable applications for OSX 10.4 using py2app. > > Ronald > > > > > > > I created a new project using XCode 3.0 with the Cocoa-Python > > Application template. > > I then proceeded to do a build on the application (n.b. I haven't > > added any of my own code yet) and the build succeeded. > > When I do a build and run however, I get the following error message > > in console: > > > > //-------------------------------------------------------------------------------------------------------------------------------- > > The Debugger Debugger is attaching to process > > [Session started at 2007-11-29 08:32:29 -0500.] > > Traceback (most recent call last): > > File "/Users/Armahg/Builds/Release/again.app/Contents/Resources/ > > main.py", line 10, in <module> > > import objc > > ImportError: No module named objc > > 2007-11-29 08:32:29.349 again[2542:10b] *** Terminating app due to > > uncaught exception 'NSInternalInconsistencyException', reason: '/ > > Users/Armahg/again/main.m:46 main() PyRun_SimpleFile failed with > > file '/Users/Armahg/Builds/Release/again.app/Contents/Resources/ > > main.py'. See console for errors.' > > 2007-11-29 08:32:29.352 again[2542:10b] Stack: ( > > 2488480363, > > 2511437979, > > 2488479819, > > 2488479882 > > ) > > //-------------------------------------------------------------------------------------------------------------------------------- > > >From what I have read, i thought pyobjC2 should work right out of > > the box with Leopard. Is there anything configuration I have to do > > to get the app working? > > > > > > I also tried to run some of the PyObjc examples and received the > > following error message > > > > //-------------------------------------------------------------------------------------------------------------------------------- > > Armahg:CurrencyConverter Armahg$ python setup.py py2app > > Traceback (most recent call last): > > File "setup.py", line 8, in <module> > > import py2app > > ImportError: No module named py2app > > //-------------------------------------------------------------------------------------------------------------------------------- > > > > TroubleShooting done so far: > > > > My current path for Python is: > > Armahg$ which python > > /Library/Frameworks/Python.framework/Versions/Current/bin/python > > > > I modified the main.m file in my test PyObjc app to read > > /*Py_SetProgramName("/usr/bin/python");*/ > > Py_SetProgramName("/Library/Frameworks/Python.framework/Versions/ > > Current/bin/python"); > > > > and this has not helped either. > > > > > > Any help given would be much appreciated. Also, in return, I'll > > document what I do and post it somewhere online so that > > other newcomers won't have to email this dev list with the same > > problem again :) > > > > Thanks in advance , > > > > George. > > > > > > > > > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: The Future of Linux Business White Paper > > from Novell. From the desktop to the data center, Linux is going > > mainstream. Let it simplify your IT future. > > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4_______________________________________________ > > Pyobjc-dev mailing list > > Pyo...@li... > > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > > |
|
From: Bill B. <bb...@ma...> - 2007-11-29 17:26:42
|
On Nov 29, 2007, at 8:35 AM, Barry Wark wrote: > So is it the official stand now that users should install new/updated > packages in the system python? My understanding (well, from Tiger > days) was that the system's python should not be modified since system > services depend on it. This seems to be the unstated rule with > Leopard, since the system python puts its own setuptools, numpy etc. > packages in sys.path before /Library/Python/2.5/site-packages. So, if > we don't install a framework build of Python, it looks like we either > have to interfere with system dependencies (such as numpy, setuptools, > pyobjc2?, etc.) or be stuck with the version that shipped in Leopard > (numpy 1.0.4 is now available, for example). > > Unfortunately, pyobjc2 won't work with the pyhton.org framework build > because the framework build was built using the 10.4u.sdk (see a > previous post by me on this subject). However, it's not hard to build > a framework build from the python.org source (there's a script that > does just that in the source tree). Once python is built with the > 10.5.sdk, pyobjc2 compiles and works just fine (we've been using it in > production for a few days already). I'm not sure how to compile in > dtrace support, but if you can live without that, everything else > appears to work. Does anyone know how to add dtrace support to Python > or does it require Apple's patches to the interpreter? > > Perhaps someone from Apple would be willing to comment... If you want to install a custom built version of Python.framework, then you will also need to build and install PyObjC. In general, do not overwrite system files. Not ever. Keep your custom stuff separated from system stuff. b.bum |
|
From: Barry W. <bar...@gm...> - 2007-11-30 01:14:35
|
Right, so if I want to, for example, install the latest numpy, I have to use MacPython. That's how I understood things, but several statements to the effect of "the python that ships with 10.5 is all you need" seemed to contradict that. On a related note, I've placed the 10.5.sdk build of MacPython that I made at http://rieke-server.physiol.washington.edu/~barry/python/python-2.5.1-macosx2007-11-26.dmg It can correctly build pyobjc2 (tests pass) on Leopard. For those of you in a similar position (wanting pyobjc2 but needing newer numpy etc.) give it a try. If this is a useful community resource, I'll work to put it in a more permanent location and/or do more regular builds (let me know if you find it useful). I haven't tested it except on our machines at work, which all have a similar configuration, so YMMV. barry On 11/29/07, Bill Bumgarner <bb...@ma...> wrote: > On Nov 29, 2007, at 8:35 AM, Barry Wark wrote: > > So is it the official stand now that users should install new/updated > > packages in the system python? My understanding (well, from Tiger > > days) was that the system's python should not be modified since system > > services depend on it. This seems to be the unstated rule with > > Leopard, since the system python puts its own setuptools, numpy etc. > > packages in sys.path before /Library/Python/2.5/site-packages. So, if > > we don't install a framework build of Python, it looks like we either > > have to interfere with system dependencies (such as numpy, setuptools, > > pyobjc2?, etc.) or be stuck with the version that shipped in Leopard > > (numpy 1.0.4 is now available, for example). > > > > Unfortunately, pyobjc2 won't work with the pyhton.org framework build > > because the framework build was built using the 10.4u.sdk (see a > > previous post by me on this subject). However, it's not hard to build > > a framework build from the python.org source (there's a script that > > does just that in the source tree). Once python is built with the > > 10.5.sdk, pyobjc2 compiles and works just fine (we've been using it in > > production for a few days already). I'm not sure how to compile in > > dtrace support, but if you can live without that, everything else > > appears to work. Does anyone know how to add dtrace support to Python > > or does it require Apple's patches to the interpreter? > > > > Perhaps someone from Apple would be willing to comment... > > If you want to install a custom built version of Python.framework, > then you will also need to build and install PyObjC. > > In general, do not overwrite system files. Not ever. Keep your > custom stuff separated from system stuff. > > b.bum > > |
|
From: Bill B. <bb...@ma...> - 2007-11-30 07:45:48
|
On Nov 29, 2007, at 5:14 PM, Barry Wark wrote: > It can correctly build pyobjc2 (tests pass) on Leopard. For those of > you in a similar position (wanting pyobjc2 but needing newer numpy > etc.) give it a try. If this is a useful community resource, I'll work > to put it in a more permanent location and/or do more regular builds > (let me know if you find it useful). I haven't tested it except on our > machines at work, which all have a similar configuration, so YMMV. Thank you for building this! For standalone packages -- including PyObjC -- you should be able to build said packages and install 'em via the standard mechanisms (I apologize -- looking back, I think I overstated the case originally). In particular, /Library/Python/2.5/site-packages/ is not populated and is intended for installing custom packages, including installing things more up to date than what is on the system. Just don't overwrite system installed Python goop as various random applications may depend upon it. If you build a custom Python, you'll need to install anything you need against that custom Python. As well, if you ship an application and depend on Leopard stock installed Python Parts, I would highly recommend that you trim library path to not include /Library/Python as early as possible in your launch. It'll prevent support heartache down the road. b.bum |