pyobjc-dev Mailing List for PyObjC (Page 44)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ronald O. <ron...@ma...> - 2009-06-18 15:19:30
|
'easy_install pyobjc' should work. That will get you the latest beta release, at least if you're running OSX 10.5, there seem to be some issues with Tiger at the moment. My current development focus is on getting PyObjC ready for SnowLeopard, until that is done there will be little or no movement in the public repository because I don't have the time to work on two development tracks at the moment. Ronald On 18 Jun, 2009, at 16:00, Tommy Grav wrote: > I am trying to install PyObjC from svn on my Intel Mac Pro running > OS X 10.5.7. > > I have > ActivePython 2.5.4.3 (ActiveState Software Inc.) based on > Python 2.5.4 (r254:67916, Jan 20 2009, 14:11:42) > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin > > and I am trying to follow the instructions at > http://docs.activestate.com/activepython/2.5/gettingstarted.html > > However I get this problem > > [Heimdall:tgrav ~/Work/myCode/PyObjC/pyobjc/pyobjc]> /usr/local/bin/ > python setup.py bdist_mpkg --open > usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] > or: setup.py --help [cmd1 cmd2 ...] > or: setup.py --help-commands > or: setup.py cmd --help > > error: invalid command 'bdist_mpkg' > > Trying instead > > Heimdall:tgrav ~/Work/myCode/PyObjC/pyobjc/pyobjc]> sudo /usr/local/ > bin/python setup.py install > Password: > running install > running bdist_egg > running egg_info > writing requirements to pyobjc.egg-info/requires.txt > writing pyobjc.egg-info/PKG-INFO > writing top-level names to pyobjc.egg-info/top_level.txt > writing dependency_links to pyobjc.egg-info/dependency_links.txt > writing manifest file 'pyobjc.egg-info/SOURCES.txt' > installing library code to build/bdist.macosx-10.3-i386/egg > running install_lib > warning: install_lib: 'build/lib' does not exist -- no Python modules > to install > creating build/bdist.macosx-10.3-i386/egg > creating build/bdist.macosx-10.3-i386/egg/EGG-INFO > copying pyobjc.egg-info/PKG-INFO -> build/bdist.macosx-10.3-i386/egg/ > EGG-INFO > copying pyobjc.egg-info/SOURCES.txt -> build/bdist.macosx-10.3-i386/ > egg/EGG-INFO > copying pyobjc.egg-info/dependency_links.txt -> build/ > bdist.macosx-10.3-i386/egg/EGG-INFO > copying pyobjc.egg-info/requires.txt -> build/bdist.macosx-10.3-i386/ > egg/EGG-INFO > copying pyobjc.egg-info/top_level.txt -> build/bdist.macosx-10.3- > i386/ > egg/EGG-INFO > copying pyobjc.egg-info/zip-safe -> build/bdist.macosx-10.3-i386/egg/ > EGG-INFO > creating 'dist/pyobjc-2.2b3-py2.5.egg' and adding 'build/ > bdist.macosx-10.3-i386/egg' to it > removing 'build/bdist.macosx-10.3-i386/egg' (and everything under it) > Processing pyobjc-2.2b3-py2.5.egg > Removing /Library/Frameworks/Python.framework/Versions/2.5/lib/ > python2.5/site-packages/pyobjc-2.2b3-py2.5.egg > Copying pyobjc-2.2b3-py2.5.egg to /Library/Frameworks/ > Python.framework/Versions/2.5/lib/python2.5/site-packages > Adding pyobjc 2.2b3 to easy-install.pth file > > Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/ > python2.5/site-packages/pyobjc-2.2b3-py2.5.egg > Processing dependencies for pyobjc==2.2b3 > Searching for pyobjc-framework-XgridFoundation==2.2b3 > Reading http://pypi.python.org/simple/pyobjc-framework-XgridFoundation/ > Reading http://pyobjc.sourceforge.net > No local packages or download links found for pyobjc-framework- > XgridFoundation==2.2b3 > error: Could not find suitable distribution for > Requirement.parse('pyobjc-framework-XgridFoundation==2.2b3') > > Anyone have any tips to get PyObjC installed and working? > > Cheers > Tommy > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Tommy G. <tg...@ma...> - 2009-06-18 15:01:12
|
I am trying to install PyObjC from svn on my Intel Mac Pro running OS X 10.5.7. I have ActivePython 2.5.4.3 (ActiveState Software Inc.) based on Python 2.5.4 (r254:67916, Jan 20 2009, 14:11:42) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin and I am trying to follow the instructions at http://docs.activestate.com/activepython/2.5/gettingstarted.html However I get this problem [Heimdall:tgrav ~/Work/myCode/PyObjC/pyobjc/pyobjc]> /usr/local/bin/ python setup.py bdist_mpkg --open usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'bdist_mpkg' Trying instead Heimdall:tgrav ~/Work/myCode/PyObjC/pyobjc/pyobjc]> sudo /usr/local/ bin/python setup.py install Password: running install running bdist_egg running egg_info writing requirements to pyobjc.egg-info/requires.txt writing pyobjc.egg-info/PKG-INFO writing top-level names to pyobjc.egg-info/top_level.txt writing dependency_links to pyobjc.egg-info/dependency_links.txt writing manifest file 'pyobjc.egg-info/SOURCES.txt' installing library code to build/bdist.macosx-10.3-i386/egg running install_lib warning: install_lib: 'build/lib' does not exist -- no Python modules to install creating build/bdist.macosx-10.3-i386/egg creating build/bdist.macosx-10.3-i386/egg/EGG-INFO copying pyobjc.egg-info/PKG-INFO -> build/bdist.macosx-10.3-i386/egg/ EGG-INFO copying pyobjc.egg-info/SOURCES.txt -> build/bdist.macosx-10.3-i386/ egg/EGG-INFO copying pyobjc.egg-info/dependency_links.txt -> build/ bdist.macosx-10.3-i386/egg/EGG-INFO copying pyobjc.egg-info/requires.txt -> build/bdist.macosx-10.3-i386/ egg/EGG-INFO copying pyobjc.egg-info/top_level.txt -> build/bdist.macosx-10.3-i386/ egg/EGG-INFO copying pyobjc.egg-info/zip-safe -> build/bdist.macosx-10.3-i386/egg/ EGG-INFO creating 'dist/pyobjc-2.2b3-py2.5.egg' and adding 'build/ bdist.macosx-10.3-i386/egg' to it removing 'build/bdist.macosx-10.3-i386/egg' (and everything under it) Processing pyobjc-2.2b3-py2.5.egg Removing /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/pyobjc-2.2b3-py2.5.egg Copying pyobjc-2.2b3-py2.5.egg to /Library/Frameworks/ Python.framework/Versions/2.5/lib/python2.5/site-packages Adding pyobjc 2.2b3 to easy-install.pth file Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/pyobjc-2.2b3-py2.5.egg Processing dependencies for pyobjc==2.2b3 Searching for pyobjc-framework-XgridFoundation==2.2b3 Reading http://pypi.python.org/simple/pyobjc-framework-XgridFoundation/ Reading http://pyobjc.sourceforge.net No local packages or download links found for pyobjc-framework- XgridFoundation==2.2b3 error: Could not find suitable distribution for Requirement.parse('pyobjc-framework-XgridFoundation==2.2b3') Anyone have any tips to get PyObjC installed and working? Cheers Tommy |
From: Ronald O. <ron...@ma...> - 2009-06-18 07:17:01
|
On 16 Jun, 2009, at 18:04, Matias Hernandez Arellano wrote: > Hi list.. > first sorry for my english xD.. > > I was trying to install pyobjc in my linux machine to try to build > little applications to iphone/ipod touch xD... > i get the svn source (a lot of folders of frameworks) > but i can't install them, i searching in the list of erros i and i see > errros with gcc, well this erros was for the CF.. i try to install CF > but i can't get it.. and without this i cant run pyobjc no? > > Someone know how i can do this? You cannot do this. PyObjC only works on MacOSX and I have no intention to support Linux or the iPhone. Iphone support might be useful in the future, but is IMHO not worthwhile at the moment given the slowish CPU in the iPhone combined with the requirement of having a snappy user experience during launch. Ronald |
From: James R E. <Jam...@lr...> - 2009-06-16 16:48:29
|
Hi Matias, Unfortunately, PyObjC only runs on the Mac. There was some effort to get PyObjC working in a GNUStep environment, but that seems to have been stalled for quite some time. Furthermore, PyObjC does not run on a standard, non-jailbroken iPhone. (It does run on jailbroken models, however, but again, you'll need a Mac for your development machine.) Cheers! James Le 16 juin 09 à 18:04, Matias Hernandez Arellano a écrit : > Hi list.. > first sorry for my english xD.. > > I was trying to install pyobjc in my linux machine to try to build > little applications to iphone/ipod touch xD... > i get the svn source (a lot of folders of frameworks) > but i can't install them, i searching in the list of erros i and i see > errros with gcc, well this erros was for the CF.. i try to install CF > but i can't get it.. and without this i cant run pyobjc no? > > Someone know how i can do this? > > Thanks in advance > > -- > Matias Hernández (Msdark) > www.msdark.archlinux.cl > ArchLinux-CL - WikiAdmin > MSN: mat...@gm... > Twitter : www.twitter.com/msdark > Plurk : www.plurk.com/msdark > Linux User: #445065 > http://keys.gnupg.net/pks/lookup?op=get&search=0xEA3EEC672189419C > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Matias H. A. <ms...@ar...> - 2009-06-16 16:32:23
|
Hi list.. first sorry for my english xD.. I was trying to install pyobjc in my linux machine to try to build little applications to iphone/ipod touch xD... i get the svn source (a lot of folders of frameworks) but i can't install them, i searching in the list of erros i and i see errros with gcc, well this erros was for the CF.. i try to install CF but i can't get it.. and without this i cant run pyobjc no? Someone know how i can do this? Thanks in advance -- Matias Hernández (Msdark) www.msdark.archlinux.cl ArchLinux-CL - WikiAdmin MSN: mat...@gm... Twitter : www.twitter.com/msdark Plurk : www.plurk.com/msdark Linux User: #445065 http://keys.gnupg.net/pks/lookup?op=get&search=0xEA3EEC672189419C |
From: Orestis M. <or...@or...> - 2009-06-16 15:19:56
|
That's because at the time of the import (when main.m is executed) there's no connection to the window server yet. To get around this, you need to start importing in the 'applicationDidFinishLaunching' stage. If you want to subclass QTMovieView, put it in a different module, and import it in the delegate method. That probably means you can't use it in Interface Builder - you may be able to set it at runtime, but I can't help you there. -- or...@or... http://orestis.gr/ On 16 Jun 2009, at 18:13, Daniel Ashbrook wrote: > Does anybody have an idea on how I can deal with this? I got around > the issue back in April but now am wanting to subclass a QTMovieView. > > Thanks, > > dan > > On Apr 27, 2009, at 12:25p, Daniel Ashbrook wrote: > >> I think I remember there being some discussion of this a while back, >> but couldn't find it. >> >> Try this: >> 1) Make a new Python Cocoa app in Xcode >> 2) In the application delegate, insert the line "import QTKit" >> 3) Run it >> >> I get: >> >> _RegisterApplication(), FAILED TO establish the default connection >> to the WindowServer, _CGSDefaultConnection() is NULL. >> 2009-04-27 12:22:41.794 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.796 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.796 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.797 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.801 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.801 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.804 QTVideoTest2[79402:10b] >> NSInternalInconsistencyException - Error (1002) creating CGSWindow >> 2009-04-27 12:22:41.811 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.813 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.813 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> 2009-04-27 12:22:41.814 QTVideoTest2[79402:10b] *** - >> [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> >> '(null)') unlocked when not locked >> 2009-04-27 12:22:41.815 QTVideoTest2[79402:10b] *** Break on >> _NSLockError() to debug. >> >> This is particularly frustrating as, in my real project, I am trying >> to make a subclass of QTKit.QTCaptureView; however, I can't, as >> importing yields the above errors. >> >> >> dan > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Daniel A. <an...@cc...> - 2009-06-16 15:14:04
|
Does anybody have an idea on how I can deal with this? I got around the issue back in April but now am wanting to subclass a QTMovieView. Thanks, dan On Apr 27, 2009, at 12:25p, Daniel Ashbrook wrote: > I think I remember there being some discussion of this a while back, > but couldn't find it. > > Try this: > 1) Make a new Python Cocoa app in Xcode > 2) In the application delegate, insert the line "import QTKit" > 3) Run it > > I get: > > _RegisterApplication(), FAILED TO establish the default connection > to the WindowServer, _CGSDefaultConnection() is NULL. > 2009-04-27 12:22:41.794 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.796 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.796 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.797 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.801 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.801 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.804 QTVideoTest2[79402:10b] > NSInternalInconsistencyException - Error (1002) creating CGSWindow > 2009-04-27 12:22:41.811 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.812 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.813 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.813 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > 2009-04-27 12:22:41.814 QTVideoTest2[79402:10b] *** - > [NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c57730> > '(null)') unlocked when not locked > 2009-04-27 12:22:41.815 QTVideoTest2[79402:10b] *** Break on > _NSLockError() to debug. > > This is particularly frustrating as, in my real project, I am trying > to make a subclass of QTKit.QTCaptureView; however, I can't, as > importing yields the above errors. > > > dan |
From: Orestis M. <or...@or...> - 2009-06-14 22:44:10
|
Hi all, I'm going to be giving an introductory PyObjC talk at Europython 2009 [1] in two weeks and I'm preparing my talk. I'm trying to select the appropriate content to present to people that don't know PyObjC, and I'm wondering into how much detail I should go into. If any previous speakers have any insights on what worked and what didn't, I'd be grateful if they shared them with me. I will post the slides to my blog when they're ready. Thanks, Orestis [1]: http://www.europython.eu |
From: Ulrich E. <li...@ne...> - 2009-06-14 15:45:29
|
Hi there ! i'm still struggling with my QTKit capture module using pyobjc and to retrieve actual image data (which should finally end up in a numpy array). i'm having trouble to get to the actual data from the CVImageBufferRef. after the fix from Ronald i'm able to access the CVImageBufferRef as hinted in most of the objective-c examples like: @objc.signature('v@:@{__CVBuffer=@}@@') def captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_ (self, captureOutput, videoFrame, sampleBuffer, connection): videoFrame = videoFrame[0] #print videoFrame, sampleBuffer print sampleBuffer.formatDescription().localizedFormatSummary() CVPixelBufferRetain(videoFrame) buffer_to_release = self.current_buffer self.current_buffer = videoFrame if buffer_to_release is not None: CVPixelBufferRelease(buffer_to_release) print "colorspace:", CVImageBufferGetColorSpace(self.current_buffer) print "displaysize", CVImageBufferGetDisplaySize(self.current_buffer) print "width:", CVPixelBufferGetWidth(self.current_buffer) print "height:", CVPixelBufferGetHeight(self.current_buffer) print "pixel_format_type:", CVPixelBufferGetPixelFormatType(self.current_buffer) print "planar:", CVPixelBufferIsPlanar(self.current_buffer) #print "extended_pixels:", CVPixelBufferGetExtendedPixels(self.current_buffer) print "datasize:", CVPixelBufferGetDataSize(self.current_buffer) print "bytes_per_row:", CVPixelBufferGetBytesPerRow(self.current_buffer) print "address:", CVPixelBufferGetBaseAddress(self.current_buffer) print "attachements:", CVBufferGetAttachments(self.current_buffer, kCVAttachmentMode_ShouldPropagate) #length = CVPixelBufferGetDataSize(self.current_buffer) ptr = CVPixelBufferGetBaseAddress(self.current_buffer) at this point i'm able to access the ptr's data using the __getitem__ accessor for each byte one by one - but this is horribly slow and will not work for my solution to capture realtime image streams into numpy arrays for further processing. the examples suggest to convert the BufferRef to a CIImage but this statement: # convert the CVImageBuffer into an NSImage cimg = CIImage.alloc().initWithCVImageBuffer_(self.current_buffer) fails with: 2009-06-14 17:21:43.587 Python[1044:b803] *** Ignoring exception: <type 'exceptions.ValueError'>: depythonifying 'pointer', got 'CVPixelBufferRef' which i cannot really interpret nor fix. i've tried several different ways of passing the ref but none did something useful. on the other hand it would be sufficient for me to get real access to the ptr using ctypes and fill the numpy array directly with the char buffer using some code like this (works fine for libdc1394 accessed with ctypes): #func = ctypes.pythonapi.PyBuffer_FromMemory #func.restype = ctypes.py_object # XXX howto convert pyobjc varlist to ctypes pointer #buffer = func(ptr, length) #ret = numpy.frombuffer( buffer, numpy.uint8 ) #ret = numpy.array(ptr.as_tuple(length)) maybe one of you has a hint how to fix the ValueError or access the ptr's data directly using ctypes. any help would be greatly appreciated - i'm fairly stuck now ;-) thanks! Ulrich Am 22.04.2009 um 07:57 schrieb Ulrich Eck: > Hi Ronald, > > thanks for your immediate action/help !!! > > i updated pyobjc-svn today and i can access the CVImageBufferRef now > (still struggling how to use it) but my initial problem is fixed now. > > when i have a working example, i'll post it to the list for the > records. > > thanks and have a nice day! > > Ulrich > > Am 21.04.2009 um 17:05 schrieb Ronald Oussoren: > >> Ulrich, >> >> The CoreVideo bindings in subversion were incorrect until a moment >> ago. I've just checked in an updated version of the Quartz bindings >> (r2166), those fix most of the problems with CoreVideo. >> >> That said, I haven't used the CoreVideo bindings in real code yet >> and there aren't any Python examples using CoreVideo either and this >> means there may be issues left. Other than creating CVPixel buffers >> in Python code (CVPixelBufferCreate and friends) the bindings should >> be complete though. >> >> To answer your question: >> >> First of all: use "import Quartz" in your module to ensure that the >> CoreVideo bindings are loaded, otherwise >> PyObjC won't load the right framework bindings. >> >> PyObjC should then automaticly deduce the correct signature for the >> delegate method, not doing so would be a bug in the QTKit bindings. >> >> BTW. Which version of PyObjC are you using? >> >> Ronald >> >> On 20 Apr, 2009, at 3:23, Ulrich Eck wrote: >> >>> hi, >>> >>> i spend a couple of days to find out how to do video capturing >>> using the current pyobc QTKit framework wrappers and run into a >>> problem... >>> >>> i couldn't find out, how to write the signature for the selector of >>> my delegate for QTCaptureDecompressedVideoOutput >>> with the following definition: >>> >>> - (void)captureOutput:(QTCaptureOutput *)captureOutput >>> didOutputVideoFrame:(CVImageBufferRef)videoFrame >>> withSampleBuffer:(QTSampleBuffer *)sampleBuffer >>> fromConnection:(QTCaptureConnection *)connection >>> >>> i tried several signature definitions like: >>> >>> @objc.signature('v@:@{__CVBuffer=*}@@') >>> @objc.signature('v@:@{__CVBuffer=@}@@') >>> @objc.signature('v@:@^{__CVBuffer=}@@') >>> @objc.signature('v@:@@@@') >>> >>> but they all end up in either a PyObcPointer created warning or a >>> NSCFType for videoStream, which seems not be usable >>> at all (can i cast to an CVImageBufferRef somehow ?). >>> >>> output example without signature: >>> PyObjCPointer created: at 0x29f4590 of type {__CVBuffer=}@@ >>> got frame: <QTCaptureDecompressedVideoOutput: 0x2981ac0> >>> <PyObjCPointer object at 0x25c8b78> <QTSampleBuffer: 0x29f3600> >>> <QTCaptureConnection: 0x2982510 vide 2vuy> >>> >>> output example for the "@objc.signature('v@:@@@@')" signature: >>> got frame: <QTCaptureDecompressedVideoOutput: 0x2982010> <NSCFType: >>> 0x29f7310> <QTSampleBuffer: 0x29f5bf0> <QTCaptureConnection: >>> 0x2982a60 vide 2vuy> >>> >>> using "@objc.signature('v@:@{__CVBuffer=}@@')" results in an error >>> message: >>> <type 'exceptions.RuntimeError'>: Cannot create FFI CIF: 1 >>> >>> >>> now i'm lost ... has anyone here on the list an idea how to convice >>> the pyobjc wrapper to pass me a valid object/reference to the >>> CVImageBufferRef or what to do with the NSCFType to get to the >>> buffer -- as shown in the example below .. i want to extract the >>> image-data >>> from the captured video (possibly as string-buffer reference for >>> further use with numpy+ctypes). >>> >>> any help is greatly appreciated !! >>> >>> thanks for your help >>> >>> cheers Ulrich >>> >>> >>> here is a minimal example of my code (created a simple pyobjc app >>> in xcode and this is the main app-delegate): >>> i can also provide the whole example for tests if needed. >>> >>> >>> ############################ >>> from Foundation import * >>> from AppKit import * >>> from QTKit import * >>> >>> k24RGBPixelFormat = 0x00000018 # 24 bit rgb >>> k32ARGBPixelFormat = 0x00000020 # 32 bit argb (Mac) >>> >>> class qtkit_captureAppDelegate(NSObject): >>> def applicationDidFinishLaunching_(self, sender): >>> NSLog("Application did finish launching.") >>> >>> >>> session = QTCaptureSession.alloc().init() >>> >>> device = >>> QTCaptureDevice.defaultInputDeviceWithMediaType_(QTMediaTypeVideo) >>> if device is None: >>> print "failed to open device." >>> return >>> >>> device.open_(None) >>> >>> input = QTCaptureDeviceInput.alloc().initWithDevice_(device) >>> session.addInput_error_(input, None) >>> >>> output = QTCaptureDecompressedVideoOutput.alloc().init() >>> >>> settings = dict(kCVPixelBufferWidthKey=640.0, >>> kCVPixelBufferHeightKey=480.0, >>> >>> kCVPixelBufferPixelFormatTypeKey=k32ARGBPixelFormat, >>> ) >>> >>> output.setPixelBufferAttributes_(settings) >>> session.addOutput_error_(output, None) >>> >>> class logger(NSObject): >>> >>> current_buffer = None >>> >>> # Declaration: >>> #- (void)captureOutput:(QTCaptureOutput *)captureOutput >>> didOutputVideoFrame:(CVImageBufferRef)videoFrame >>> # withSampleBuffer:(QTSampleBuffer *)sampleBuffer >>> fromConnection:(QTCaptureConnection *)connection >>> >>> #@objc.signature('v@:@{__CVBuffer=*}@@') >>> #@objc.signature('v@:@{__CVBuffer=@}@@') >>> #@objc.signature('v@:@^{__CVBuffer=}@@') >>> @objc.signature('v@:@@@@') >>> def >>> captureOutput_didOutputVideoFrame_withSampleBuffer_fromConnection_ >>> (self, captureOutput, videoFrame, sampleBuffer, connection): >>> NSLog("got frame: %s %s %s %s" % (captureOutput, >>> videoFrame, sampleBuffer, connection)) >>> >>> # always have only one frame retained >>> #CVBufferRetain(videoFrame) >>> #buffer_to_release = self.current_buffer >>> #self.current_buffer = videoFrame >>> #if buffer_to_release is not None: >>> # CVBufferRelease(buffer_to_release) >>> >>> # convert the CVImageBuffer into an NSImage >>> #cimg = CIImage.initWithCVImageBuffer_(test) >>> #rep = NSCIImageRep.initWithCIImage_(cimg) >>> #nimg = NSImage.alloc().initWithSize_(rep.size()) >>> #nimg.addRepresentation_(rep) >>> >>> >>> cb = logger.alloc().init() >>> output.setDelegate_(cb) >>> session.startRunning() >>> >>> self._data = (session, device, input, output, cb) >>> >>> ############################ >>> >>> ------------------------------------------------------------------------------ >>> Stay on top of everything new and different, both inside and >>> around Java (TM) technology - register by April 22, and save >>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >>> 300 plus technical and hands-on sessions. Register today. >>> Use priority code J9JMT32. http://p.sf.net/sfu/p_______________________________________________ >>> Pyobjc-dev mailing list >>> Pyo...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Matt L. <jm...@gm...> - 2009-06-10 17:36:51
|
Barry, you cant begin to know how helpful that is! Thank you so much! I really appreciate the level of detail and the helpful tips and info inside the code. I have just glanced over the files and it already makes 100% more sense to me. I cant wait to start learning and coding more. Thanks again! Matt On Wed, Jun 10, 2009 at 11:20 AM, Barry Wark <bar...@gm...> wrote: > Matt, > > I've attached the thee (!) files that translate your code as well as > an Xcode project to build and run them. I've made use of the > Objective-C 2.0 @property and @synthesized getters/setters. In this > case you could get away with using the instance variables directly > (though this is bad practice in ObjC because it exposes the > implementation and it's hard to convert to properties later, unlike > Python). > > Cheers, > Barry > > > On Wed, Jun 10, 2009 at 12:18 AM, Matt Lott<jm...@gm...> wrote: > > Hey guys, I am trying to learn Objective-C. All of my current programming > > background is in Python and this new syntax isn't sitting well with me. I > > have been reading tons of documentation and seen loads of tutorial > videos, > > but I'm just not quite picking it up yet. I would be really appreciative > if > > someone could translate this sample Python code into ObjC so I can make > all > > the connections in my head. I think it will give me the kick start I > really > > need to dive deeper into the language. Please be sure to include both > header > > and implementation so I can see the whole picture. > > > > Thanks in advance! > > > > > > #!/usr/bin/python > > > > # This section to show class and method structure > > class Employee(object): > > def __init__(self, name, salary): > > self.name = name > > self.salary = salary > > > > def nameUpper(self): > > return self.name.upper() > > > > def giveRaise(self, percent): > > self.salary *= (1.0 + percent) > > > > > > # This section to show normal function structure > > def printHeader(): > > print 'Company HR' > > print '-' * 20 > > print '' > > > > > > def main(): > > printHeader() > > matt = Employee('Matt', 100000) > > print matt.nameUpper() > > print (%s: %d) % ('Old Salary', matt.salary) > > matt.giveRaise(.20) > > print (%s: %d) % ('New Salary', matt.salary) > > > > > > if __name__ == '__main__': > > main() > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > Crystal Reports - New Free Runtime and 30 Day Trial > > Check out the new simplified licensing option that enables unlimited > > royalty-free distribution of the report engine for externally facing > > server and web deployment. > > http://p.sf.net/sfu/businessobjects > > _______________________________________________ > > Pyobjc-dev mailing list > > Pyo...@li... > > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > > > > |
From: Barry W. <bar...@gm...> - 2009-06-10 16:35:30
|
On Wed, Jun 10, 2009 at 9:05 AM, Ronald Oussoren<ron...@ma...> wrote: > > On 10 Jun, 2009, at 7:55, Barry Wark wrote: > >> On Thu, Jun 4, 2009 at 8:48 AM, Jonathan Saggau<sa...@gm...> wrote: >>> >>> Ronald Oussoren wrote: >>>> >>>> I don't agree. There could be advantages for regular python as well, >>>> IMHO removing CPython's refcounting is a necessary first step for >>>> removing the GIL. Removing the GIL would definitely be an advantage >>>> for general python code, especially because using multiple independent >>>> threads of execution is the only way to seriously improve performance >>>> on modern hardware because sadly enough the "wait a year and then my >>>> single-threaded code is twice as fast"-era is over. Multiprocessing is >>>> a cool hack, but isn't a real solution; I have a number of programs >>>> that use multiple threads and need shared memory to get fast enough >>>> communications (basicly because large objects get transferred between >>>> threads). >>>> >>>> Ronald >>> >>> As a curiosity for those who know the internals of Python better than I >>> do, is there any reason to believe that most existing python code would >>> even "care" which flavor of GC it's running under? >> >> As an aside, the Google guys think that they can pull this off without >> affecting even C-language extensions. I just discovered the Unladed >> Swallow project (http://code.google.com/p/unladen-swallow/) appears to >> be their attempt to reimplement the Python VM on top of LLVM. Their >> goals are performance, but they also mention pluggable GC and some >> other very cool tricks. I think it would definitely be worth keeping >> an eye on this project. If it progresses as they claim, it may be a >> much better starting point for any efforts to bring Python and the >> ObjC runtime closer. > > I know of Unladen Swallow and tracking their progress. I've spoken with > someone on their team at Pycon and they are very confident that they can > pull of their performance goals, basicly by going through the available > literature and implementing those ideas. That's easier said than done, but > Google doesn't have a shortage of PhD's and offices of the Unladen Swallow > team are close to that of some of the authors of research papers that they > intend to use. > > I'm not so sure about not affecting C extensions, especially not in the > context of the ObjC garbage collector due to some special limitations. My (limited!) understanding of the Python memory semantics wrt C extensions made me think this was going to be tough too, but you never know. As you said, they have some very smart folks there. > > BTW. The bit that excites me even more than the performance work is their > secondairy goal of getting rid of the GIL. I have a number of projects where > I have written a custom C extension just to make use of additional cores and > where I would have been able to use an existing extension or even pure > python code if Python hadn't had the GIL. (And no, multiprocessing wouldn't > work in those projects, the communication overhead between processes would > have been too large). Yes, getting rid of the GIL would be huge. > > Ronald >> >> -B >> >>> >>> >>> Jonathan 'usually lurking' Saggau >>> >>> >>> ------------------------------------------------------------------------------ >>> OpenSolaris 2009.06 is a cutting edge operating system for enterprises >>> looking to deploy the next generation of Solaris that includes the latest >>> innovations from Sun and the OpenSource community. Download a copy and >>> enjoy capabilities such as Networking, Storage and Virtualization. >>> Go to: http://p.sf.net/sfu/opensolaris-get >>> _______________________________________________ >>> Pyobjc-dev mailing list >>> Pyo...@li... >>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >>> > > |
From: Ronald O. <ron...@ma...> - 2009-06-10 16:06:07
|
On 10 Jun, 2009, at 7:55, Barry Wark wrote: > On Thu, Jun 4, 2009 at 8:48 AM, Jonathan Saggau<sa...@gm...> > wrote: >> Ronald Oussoren wrote: >>> >>> I don't agree. There could be advantages for regular python as well, >>> IMHO removing CPython's refcounting is a necessary first step for >>> removing the GIL. Removing the GIL would definitely be an advantage >>> for general python code, especially because using multiple >>> independent >>> threads of execution is the only way to seriously improve >>> performance >>> on modern hardware because sadly enough the "wait a year and then my >>> single-threaded code is twice as fast"-era is over. >>> Multiprocessing is >>> a cool hack, but isn't a real solution; I have a number of programs >>> that use multiple threads and need shared memory to get fast enough >>> communications (basicly because large objects get transferred >>> between >>> threads). >>> >>> Ronald >> As a curiosity for those who know the internals of Python better >> than I >> do, is there any reason to believe that most existing python code >> would >> even "care" which flavor of GC it's running under? > > As an aside, the Google guys think that they can pull this off without > affecting even C-language extensions. I just discovered the Unladed > Swallow project (http://code.google.com/p/unladen-swallow/) appears to > be their attempt to reimplement the Python VM on top of LLVM. Their > goals are performance, but they also mention pluggable GC and some > other very cool tricks. I think it would definitely be worth keeping > an eye on this project. If it progresses as they claim, it may be a > much better starting point for any efforts to bring Python and the > ObjC runtime closer. I know of Unladen Swallow and tracking their progress. I've spoken with someone on their team at Pycon and they are very confident that they can pull of their performance goals, basicly by going through the available literature and implementing those ideas. That's easier said than done, but Google doesn't have a shortage of PhD's and offices of the Unladen Swallow team are close to that of some of the authors of research papers that they intend to use. I'm not so sure about not affecting C extensions, especially not in the context of the ObjC garbage collector due to some special limitations. BTW. The bit that excites me even more than the performance work is their secondairy goal of getting rid of the GIL. I have a number of projects where I have written a custom C extension just to make use of additional cores and where I would have been able to use an existing extension or even pure python code if Python hadn't had the GIL. (And no, multiprocessing wouldn't work in those projects, the communication overhead between processes would have been too large). Ronald > -B > >> >> >> Jonathan 'usually lurking' Saggau >> >> ------------------------------------------------------------------------------ >> OpenSolaris 2009.06 is a cutting edge operating system for >> enterprises >> looking to deploy the next generation of Solaris that includes the >> latest >> innovations from Sun and the OpenSource community. Download a copy >> and >> enjoy capabilities such as Networking, Storage and Virtualization. >> Go to: http://p.sf.net/sfu/opensolaris-get >> _______________________________________________ >> Pyobjc-dev mailing list >> Pyo...@li... >> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev >> |
From: Barry W. <bar...@gm...> - 2009-06-10 15:20:43
|
Matt, I've attached the thee (!) files that translate your code as well as an Xcode project to build and run them. I've made use of the Objective-C 2.0 @property and @synthesized getters/setters. In this case you could get away with using the instance variables directly (though this is bad practice in ObjC because it exposes the implementation and it's hard to convert to properties later, unlike Python). Cheers, Barry On Wed, Jun 10, 2009 at 12:18 AM, Matt Lott<jm...@gm...> wrote: > Hey guys, I am trying to learn Objective-C. All of my current programming > background is in Python and this new syntax isn't sitting well with me. I > have been reading tons of documentation and seen loads of tutorial videos, > but I'm just not quite picking it up yet. I would be really appreciative if > someone could translate this sample Python code into ObjC so I can make all > the connections in my head. I think it will give me the kick start I really > need to dive deeper into the language. Please be sure to include both header > and implementation so I can see the whole picture. > > Thanks in advance! > > > #!/usr/bin/python > > # This section to show class and method structure > class Employee(object): > def __init__(self, name, salary): > self.name = name > self.salary = salary > > def nameUpper(self): > return self.name.upper() > > def giveRaise(self, percent): > self.salary *= (1.0 + percent) > > > # This section to show normal function structure > def printHeader(): > print 'Company HR' > print '-' * 20 > print '' > > > def main(): > printHeader() > matt = Employee('Matt', 100000) > print matt.nameUpper() > print (%s: %d) % ('Old Salary', matt.salary) > matt.giveRaise(.20) > print (%s: %d) % ('New Salary', matt.salary) > > > if __name__ == '__main__': > main() > > > > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |
From: Barry W. <bar...@gm...> - 2009-06-10 14:55:58
|
On Thu, Jun 4, 2009 at 8:48 AM, Jonathan Saggau<sa...@gm...> wrote: > Ronald Oussoren wrote: >> >> I don't agree. There could be advantages for regular python as well, >> IMHO removing CPython's refcounting is a necessary first step for >> removing the GIL. Removing the GIL would definitely be an advantage >> for general python code, especially because using multiple independent >> threads of execution is the only way to seriously improve performance >> on modern hardware because sadly enough the "wait a year and then my >> single-threaded code is twice as fast"-era is over. Multiprocessing is >> a cool hack, but isn't a real solution; I have a number of programs >> that use multiple threads and need shared memory to get fast enough >> communications (basicly because large objects get transferred between >> threads). >> >> Ronald > As a curiosity for those who know the internals of Python better than I > do, is there any reason to believe that most existing python code would > even "care" which flavor of GC it's running under? As an aside, the Google guys think that they can pull this off without affecting even C-language extensions. I just discovered the Unladed Swallow project (http://code.google.com/p/unladen-swallow/) appears to be their attempt to reimplement the Python VM on top of LLVM. Their goals are performance, but they also mention pluggable GC and some other very cool tricks. I think it would definitely be worth keeping an eye on this project. If it progresses as they claim, it may be a much better starting point for any efforts to bring Python and the ObjC runtime closer. -B > > > Jonathan 'usually lurking' Saggau > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |
From: Matt L. <jm...@gm...> - 2009-06-10 07:20:16
|
Hey guys, I am trying to learn Objective-C. All of my current programming background is in Python and this new syntax isn't sitting well with me. I have been reading tons of documentation and seen loads of tutorial videos, but I'm just not quite picking it up yet. I would be really appreciative if someone could translate this sample Python code into ObjC so I can make all the connections in my head. I think it will give me the kick start I really need to dive deeper into the language. Please be sure to include both header and implementation so I can see the whole picture. Thanks in advance! #!/usr/bin/python # This section to show class and method structure class Employee(object): def __init__(self, name, salary): self.name = name self.salary = salary def nameUpper(self): return self.name.upper() def giveRaise(self, percent): self.salary *= (1.0 + percent) # This section to show normal function structure def printHeader(): print 'Company HR' print '-' * 20 print '' def main(): printHeader() matt = Employee('Matt', 100000) print matt.nameUpper() print (%s: %d) % ('Old Salary', matt.salary) matt.giveRaise(.20) print (%s: %d) % ('New Salary', matt.salary) if __name__ == '__main__': main() |
From: Ronald O. <ron...@ma...> - 2009-06-07 14:45:54
|
On 3 Jun, 2009, at 23:54, Ronald Oussoren wrote: >> > > I don't agree. There could be advantages for regular python as well, > IMHO removing CPython's refcounting is a necessary first step for > removing the GIL. Removing the GIL would definitely be an advantage > for general python code, especially because using multiple > independent threads of execution is the only way to seriously > improve performance on modern hardware because sadly enough the > "wait a year and then my single-threaded code is twice as fast"-era > is over. Multiprocessing is a cool hack, but isn't a real solution; > I have a number of programs that use multiple threads and need > shared memory to get fast enough communications (basicly because > large objects get transferred between threads). I have another reason for wanting this: better decoupling model code from the GUI. I'm sure I'm not the only one that either has to jump through hoops to expose Python objects to the GUI (e.g. using the output of a library like SQLAlchemy in a GUI that uses Key-Value Bindings), or uses Cocoa datastructures such as NSArray in code that basicly has nothing to do with the GUI. A version of Python that has more pervasive support for ObjC classes could make it easier to keep GUI code and non-GUI code. Ronald |
From: Ronald O. <ron...@ma...> - 2009-06-04 16:22:44
|
On 4 Jun, 2009, at 0:57, Greg Ewing wrote: > Ronald Oussoren wrote: > >> If I had the time, and funding, I'd much rather work on a port of >> Python that uses the ObjC garbage collector instead of Python's >> native >> memory management. > > While that might help PyObjC, I'd be very worried about > what effect it might have on the performance of the rest > of Python. > > Also I'm not sure I like the idea of having to use a > special version of Python in order to be able to use > ObjC. > > In general, I think that "create a special version of > Python to make X work" is an anti-pattern. Think about > what would happen if everyone did that, and then you > wanted to use X and Y at the same time, where X and Y > each required their own special Python version. It would > be DLL hell on steroids. BTW. We already have this in a way, there's Jython if you want to use Java, IronPython if you want to use .NET, .... and let's not forget Stackless Python. There is a risk for fragmentation, but I don't think this is a very large risk because maintaining a patched version of Python is a relatively large amount of work and it is therefore for most usecases way more convenient to not do that. If I'd ever get around to creating a port of Python that uses the Python GC I'd try to keep it as close as possible to the real one, any deviation from CPython is a possibility for maintenance problems later on and would therefore need to have a big advantage to offset the maintenance cost. Another thing that's worrisome is 3th-party extensions, one of the reasons to like Python is the large set of packages at PyPI, loosing access to those would seriously reduce the uptake of a patched version of python. Ronald > > -- > Greg > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Ronald O. <ron...@ma...> - 2009-06-04 16:15:05
|
On 4 Jun, 2009, at 17:48, Jonathan Saggau wrote: > Ronald Oussoren wrote: >> >> I don't agree. There could be advantages for regular python as >> well, IMHO removing CPython's refcounting is a necessary first step >> for removing the GIL. Removing the GIL would definitely be an >> advantage for general python code, especially because using >> multiple independent threads of execution is the only way to >> seriously improve performance on modern hardware because sadly >> enough the "wait a year and then my single-threaded code is twice >> as fast"-era is over. Multiprocessing is a cool hack, but isn't a >> real solution; I have a number of programs that use multiple >> threads and need shared memory to get fast enough communications >> (basicly because large objects get transferred between threads). >> >> Ronald > As a curiosity for those who know the internals of Python better > than I do, is there any reason to believe that most existing python > code would even "care" which flavor of GC it's running under? Sadly enough, yes. Code like "data = open(filename, 'r').read()" is pretty common in small python scripts, and mostly works fine in a refcounting python, but doesn't work as well with other GCs because the result of open might not be collected until a long time after the file is used. That's no problem in general, but is a problem when dealing with scarce resources such as file handles. Such code would already run into problems on Jython, and possibly on IronPython as well. When you use a modern version of python the correct way to write this isn't much more code: :> with open(filename 'r') as fp: :> data = fp.read() In earlier versions of python this would have to be written as: :> fp = open(filename, 'r') :> try: :> data = fp.read() :> finally: :> fp.close() Which explains why a lot of people would rely on an implementation detail of the garbage collector ;-). The really interesting questions are if there is code like this in major libraries (such as sqlalchemy or twisted), and if there is code that relies on really obscure edge-cases that might be hard to reproduce with another collector. In CPython you can revive an object in the __del__ of a class. That is: :> junk = [] :> class MyClass: :> def __del__(self): :> junk.append(self) :> :> a = MyClass() :> del a In this snippet an instance of MyClass is created, and immediately after that the only reference to it is removed and CPython tries to delete the object. The __del__ method then adds the object to a global list, and therefore revives the object. Code like this cannot work with Apple's GC, that collector requires that objects go away when the GC finalizes them. I sincerely hope that no-one actually uses this loophole in production code, it is really nasty behaviour. Ronald |
From: Jonathan S. <sa...@gm...> - 2009-06-04 15:48:29
|
Ronald Oussoren wrote: > > I don't agree. There could be advantages for regular python as well, > IMHO removing CPython's refcounting is a necessary first step for > removing the GIL. Removing the GIL would definitely be an advantage > for general python code, especially because using multiple independent > threads of execution is the only way to seriously improve performance > on modern hardware because sadly enough the "wait a year and then my > single-threaded code is twice as fast"-era is over. Multiprocessing is > a cool hack, but isn't a real solution; I have a number of programs > that use multiple threads and need shared memory to get fast enough > communications (basicly because large objects get transferred between > threads). > > Ronald As a curiosity for those who know the internals of Python better than I do, is there any reason to believe that most existing python code would even "care" which flavor of GC it's running under? Jonathan 'usually lurking' Saggau |
From: Ronald O. <ron...@ma...> - 2009-06-04 06:55:13
|
On 4 Jun, 2009, at 0:57, Greg Ewing wrote: > Ronald Oussoren wrote: > >> If I had the time, and funding, I'd much rather work on a port of >> Python that uses the ObjC garbage collector instead of Python's >> native >> memory management. > > While that might help PyObjC, I'd be very worried about > what effect it might have on the performance of the rest > of Python. > > Also I'm not sure I like the idea of having to use a > special version of Python in order to be able to use > ObjC. > > In general, I think that "create a special version of > Python to make X work" is an anti-pattern. Think about > what would happen if everyone did that, and then you > wanted to use X and Y at the same time, where X and Y > each required their own special Python version. It would > be DLL hell on steroids. I don't agree. There could be advantages for regular python as well, IMHO removing CPython's refcounting is a necessary first step for removing the GIL. Removing the GIL would definitely be an advantage for general python code, especially because using multiple independent threads of execution is the only way to seriously improve performance on modern hardware because sadly enough the "wait a year and then my single-threaded code is twice as fast"-era is over. Multiprocessing is a cool hack, but isn't a real solution; I have a number of programs that use multiple threads and need shared memory to get fast enough communications (basicly because large objects get transferred between threads). Ronald > > -- > Greg > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Greg E. <gre...@ca...> - 2009-06-03 22:56:41
|
Ronald Oussoren wrote: > If I had the time, and funding, I'd much rather work on a port of > Python that uses the ObjC garbage collector instead of Python's native > memory management. While that might help PyObjC, I'd be very worried about what effect it might have on the performance of the rest of Python. Also I'm not sure I like the idea of having to use a special version of Python in order to be able to use ObjC. In general, I think that "create a special version of Python to make X work" is an anti-pattern. Think about what would happen if everyone did that, and then you wanted to use X and Y at the same time, where X and Y each required their own special Python version. It would be DLL hell on steroids. -- Greg |
From: Ronald O. <ron...@ma...> - 2009-06-03 06:06:57
|
On 3 Jun, 2009, at 0:19, Barry Wark wrote: > Can anyone comment on the current state of PyObjC in relation to the > Objective-C garbage collector? As @bbum said on Twitter: "... I just > don't write desktop code w/o GC anymore. Waste of time not to use GC." > In a PyObjC app that loads Objective-C code via plugin, can we use GC > in the plugin code? No. PyObjC application won't use garbage collection. Furthermore, even though I have added code to PyObjC that should make PyObjC safe when used in a GC environment (such as using CFRetain/CFRelease instead of - retain/-release) I haven't tested yet if that actually works as designed. And to be honest, I haven't even checked yet how I ensure that GC is turned on automaticly. Actually getting PyObjC to be to a point where it is safe to use in GC environment would be several days work, which would be needed to create an environment where the application runs with the ObjC GC turned on and then run tests to ensure that PyObjC keeps working. If I had the time, and funding, I'd much rather work on a port of Python that uses the ObjC garbage collector instead of Python's native memory management. That would allow for a much improved integration between Python and Objective-C, and could remove a number of issues where the bridge is not as transparent as I'd like: KVO could be made to work with native Python objects, no need to worry about ObjC-style weak references where you have to keep the proxy object alive manually (e.g. the outlineview dataprovider protocol). Sadly enough this would probably require several weeks of full-time work, and that's not something I'm able to pull of without funding. Ronald > > Thanks, > Barry > > ------------------------------------------------------------------------------ > OpenSolaris 2009.06 is a cutting edge operating system for enterprises > looking to deploy the next generation of Solaris that includes the > latest > innovations from Sun and the OpenSource community. Download a copy and > enjoy capabilities such as Networking, Storage and Virtualization. > Go to: http://p.sf.net/sfu/opensolaris-get > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |
From: Barry W. <bar...@gm...> - 2009-06-02 22:19:34
|
Can anyone comment on the current state of PyObjC in relation to the Objective-C garbage collector? As @bbum said on Twitter: "... I just don't write desktop code w/o GC anymore. Waste of time not to use GC." In a PyObjC app that loads Objective-C code via plugin, can we use GC in the plugin code? Thanks, Barry |
From: Ronald O. <ron...@ma...> - 2009-06-02 20:00:49
|
On 2 Jun, 2009, at 20:44, Daniel Ashbrook wrote: > Is this expected behavior? > >>>> from Foundation import * >>>> NSMakePoint(100000100, 0) > <NSPoint x=100000096.0 y=0.0> > > Shouldn't I get out what I put in? Yes, but you're running into a limitation of the platform. The field of an NSPoint structure are C floats and a float cannot accurately represent the value 100000100, that's why you get a slighty different one. Ronald |
From: Adam A. <ad...@at...> - 2009-06-02 19:59:50
|
On 2 Jun 2009, at 14:44, Daniel Ashbrook wrote: > Is this expected behavior? > >>>> from Foundation import * >>>> NSMakePoint(100000100, 0) > <NSPoint x=100000096.0 y=0.0> > > Shouldn't I get out what I put in? > > dan I think it's to be expected, if unfortunate. NSPoint's components are CGFloat-valued (in 10.5 at least; in 10.4 and earlier, they're just 'float'), and I get the same result with this C code: > #include <ApplicationServices/ApplicationServices.h> > int main(int argc, const char *argv[]) { > CGFloat x; > x = 100000100; > printf("%f\n", x); > return 0; > } When building for 32-bit systems, CGFloat is defined as a C float, and for 64-bit, it's a double. I am indeed on a 32-bit system. The C code above works correctly (gives 100000100.000000) if I explicitly declare 'x' as double instead of CGFloat. Unfortunately, you can't change this for pre-compiled C/ObjC functions that will be expecting an NSPoint consisting of two 32-bit floats, so you'll have to work within this limitation. - Adam |