From prologic at shortcircuit.net.au Wed Nov 3 02:25:49 2010 From: prologic at shortcircuit.net.au (James Mills) Date: Wed, 3 Nov 2010 11:25:49 +1000 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups Message-ID: Hi, Been looking around the web for how you might resolve hostnames on Mac OS X using OS X's sys calls to do so. Can anyone shed any light on this ? cheers James -- -- James Mills -- -- "Problems are solved by method" From njriley at illinois.edu Wed Nov 3 02:47:07 2010 From: njriley at illinois.edu (Nicholas Riley) Date: Tue, 2 Nov 2010 20:47:07 -0500 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups In-Reply-To: References: Message-ID: <20101103014707.GA18167@illinois.edu> On Wed, Nov 03, 2010 at 11:25:49AM +1000, James Mills wrote: > Been looking around the web for how you might resolve hostnames on Mac > OS X using OS X's sys calls to do so. > > Can anyone shed any light on this ? Try socket.gethostbyname for IPv4-only or socket.getaddrinfo for IPv4/IPv6. For example: >>> import socket >>> socket.gethostbyname('mary.local') '192.168.71.1' >>> socket.getaddrinfo('bookworm.griley.members.mac.com', None, socket.AF_INET6, socket.SOCK_STREAM) [(30, 1, 6, '', ('fda1:5f1b:430f:37cc:214:51ff:fe0b:d94', 0, 0, 0))] Check the Python docs (http://docs.python.org/library/socket.html) for information on the tuples returned by getaddrinfo. -- Nicholas Riley From prologic at shortcircuit.net.au Wed Nov 3 03:16:34 2010 From: prologic at shortcircuit.net.au (James Mills) Date: Wed, 3 Nov 2010 12:16:34 +1000 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups In-Reply-To: <20101103014707.GA18167@illinois.edu> References: <20101103014707.GA18167@illinois.edu> Message-ID: On Wed, Nov 3, 2010 at 11:47 AM, Nicholas Riley wrote: > Try socket.gethostbyname for IPv4-only or socket.getaddrinfo for > IPv4/IPv6. ?For example: > >>>> import socket >>>> socket.gethostbyname('mary.local') > '192.168.71.1' >>>> socket.getaddrinfo('bookworm.griley.members.mac.com', None, socket.AF_INET6, socket.SOCK_STREAM) > [(30, 1, 6, '', ('fda1:5f1b:430f:37cc:214:51ff:fe0b:d94', 0, 0, 0))] The problem with this (that we have) is that when/if the dns servers change (example: unplug the wire, turn on the wireless) this method of resolving names isn't able to tell that the dns servers have changed quickly enough. On Windows we've solved this by hooking into win32 calls (windns I believe) and using ctypes. We're after something similar on the Mac OS X platform ideally... cheers James -- -- James Mills -- -- "Problems are solved by method" From njriley at illinois.edu Wed Nov 3 03:32:43 2010 From: njriley at illinois.edu (Nicholas Riley) Date: Tue, 2 Nov 2010 21:32:43 -0500 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups In-Reply-To: References: <20101103014707.GA18167@illinois.edu> Message-ID: <20101103023243.GA21184@illinois.edu> On Wed, Nov 03, 2010 at 12:16:34PM +1000, James Mills wrote: > The problem with this (that we have) is that when/if the dns servers change > (example: unplug the wire, turn on the wireless) this method of resolving names > isn't able to tell that the dns servers have changed quickly enough. > > On Windows we've solved this by hooking into win32 calls (windns I believe) > and using ctypes. > > We're after something similar on the Mac OS X platform ideally... socket.* *does* use the Mac native resolution mechanism. What you're running into is that they cache too aggressively; I've noticed this myself especially on 10.6. Executing 'dscacheutil -flushcache' should help; it doesn't require any privileges. You can use the SystemConfiguration framework to watch for DNS changes (State:/Network/Global/DNS). It's wrapped by PyObjC. At least on my 10.5 Mac here there's a demo script in /Developer/Examples/Python/PyObjC/SystemConfiguration/CallbackDemo/callbacks.py which registers for dynamic store notifications. You could also talk to scutil if you wanted; it's also got the ability to register for notifications: % scutil > n.add State:/Network/Global/DNS > n.watch > notification callback (store address = 0x103730). changed key [0] = State:/Network/Global/DNS -- Nicholas Riley From prologic at shortcircuit.net.au Wed Nov 3 03:38:41 2010 From: prologic at shortcircuit.net.au (James Mills) Date: Wed, 3 Nov 2010 12:38:41 +1000 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups In-Reply-To: <20101103023243.GA21184@illinois.edu> References: <20101103014707.GA18167@illinois.edu> <20101103023243.GA21184@illinois.edu> Message-ID: On Wed, Nov 3, 2010 at 12:32 PM, Nicholas Riley wrote: > At least on my 10.5 Mac here there's a demo script in > /Developer/Examples/Python/PyObjC/SystemConfiguration/CallbackDemo/callbacks.py I don't seem to have a "Python" directory in /Developer/Examples/ on my Mac (10.6.4) cheers James -- -- James Mills -- -- "Problems are solved by method" From njriley at illinois.edu Wed Nov 3 03:56:40 2010 From: njriley at illinois.edu (Nicholas Riley) Date: Tue, 2 Nov 2010 21:56:40 -0500 Subject: [Pythonmac-SIG] Mac OS X native DNS lookups In-Reply-To: References: <20101103014707.GA18167@illinois.edu> <20101103023243.GA21184@illinois.edu> Message-ID: <20101103025640.GA23641@illinois.edu> On Wed, Nov 03, 2010 at 12:38:41PM +1000, James Mills wrote: > On Wed, Nov 3, 2010 at 12:32 PM, Nicholas Riley wrote: > > At least on my 10.5 Mac here there's a demo script in > > /Developer/Examples/Python/PyObjC/SystemConfiguration/CallbackDemo/callbacks.py > > I don't seem to have a "Python" directory in /Developer/Examples/ on > my Mac (10.6.4) It's distributed with PyObjC - you can also get it from http://svn.red-bean.com/pyobjc/trunk/pyobjc/pyobjc-framework-SystemConfiguration/Examples/CallbackDemo/ -- Nicholas Riley From prologic at shortcircuit.net.au Wed Nov 3 04:07:34 2010 From: prologic at shortcircuit.net.au (James Mills) Date: Wed, 3 Nov 2010 13:07:34 +1000 Subject: [Pythonmac-SIG] pyobjc-framework-ScreenSaver-2.3 fails to install Message-ID: Hi, I probably don't need the pyobjc-framework-ScreenSaver-2.3 but doing an "easy_install pyobjc" tries to download, compile and install this and fails with several errors: Installed /Library/Python/2.6/site-packages/pyobjc_framework_SearchKit-2.3-py2.6.egg Searching for pyobjc-framework-ScreenSaver==2.3 Reading http://pypi.python.org/simple/pyobjc-framework-ScreenSaver/ Best match: pyobjc-framework-ScreenSaver 2.3 Downloading http://pypi.python.org/packages/source/p/pyobjc-framework-ScreenSaver/pyobjc-framework-ScreenSaver-2.3.tar.gz#md5=f8e9300351df4b8b38e9965b2319562b Processing pyobjc-framework-ScreenSaver-2.3.tar.gz Running pyobjc-framework-ScreenSaver-2.3/setup.py -q bdist_egg --dist-dir /var/folders/he/healpZWsEkCMBaftAtzVq1OdgRM/-Tmp-/easy_install-SmH6sH/pyobjc-framework-ScreenSaver-2.3/egg-dist-tmp-OGTK8D hgtools.SubprocessManager('.') could not find files: abort: There is no Mercurial repository here (.hg not found)! Modules/_ScreenSaver_inlines.m:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'function_map' Modules/_ScreenSaver_inlines.m:18: warning: return type defaults to 'int' Modules/_ScreenSaver_inlines.m:18: warning: function declaration isn't a prototype Modules/_ScreenSaver_inlines.m: In function 'PyObjC_MODULE_INIT': Modules/_ScreenSaver_inlines.m:19: warning: implicit declaration of function 'PyObjC_MODULE_CREATE' Modules/_ScreenSaver_inlines.m:19: warning: initialization makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:21: warning: implicit declaration of function 'PyObjC_INITERROR' Modules/_ScreenSaver_inlines.m:25: warning: implicit declaration of function 'PyObjC_CreateInlineTab' Modules/_ScreenSaver_inlines.m:25: error: 'function_map' undeclared (first use in this function) Modules/_ScreenSaver_inlines.m:25: error: (Each undeclared identifier is reported only once Modules/_ScreenSaver_inlines.m:25: error: for each function it appears in.) Modules/_ScreenSaver_inlines.m:25: warning: passing argument 3 of 'PyModule_AddObject' makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:29: warning: implicit declaration of function 'PyObjC_INITDONE' Modules/_ScreenSaver_inlines.m:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'function_map' Modules/_ScreenSaver_inlines.m:18: warning: return type defaults to 'int' Modules/_ScreenSaver_inlines.m:18: warning: function declaration isn't a prototype Modules/_ScreenSaver_inlines.m: In function 'PyObjC_MODULE_INIT': Modules/_ScreenSaver_inlines.m:19: warning: implicit declaration of function 'PyObjC_MODULE_CREATE' Modules/_ScreenSaver_inlines.m:19: warning: initialization makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:21: warning: implicit declaration of function 'PyObjC_INITERROR' Modules/_ScreenSaver_inlines.m:25: warning: implicit declaration of function 'PyObjC_CreateInlineTab' Modules/_ScreenSaver_inlines.m:25: error: 'function_map' undeclared (first use in this function) Modules/_ScreenSaver_inlines.m:25: error: (Each undeclared identifier is reported only once Modules/_ScreenSaver_inlines.m:25: error: for each function it appears in.) Modules/_ScreenSaver_inlines.m:25: warning: passing argument 3 of 'PyModule_AddObject' makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:29: warning: implicit declaration of function 'PyObjC_INITDONE' Modules/_ScreenSaver_inlines.m:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'function_map' Modules/_ScreenSaver_inlines.m:18: warning: return type defaults to 'int' Modules/_ScreenSaver_inlines.m:18: warning: function declaration isn't a prototype Modules/_ScreenSaver_inlines.m: In function 'PyObjC_MODULE_INIT': Modules/_ScreenSaver_inlines.m:19: warning: implicit declaration of function 'PyObjC_MODULE_CREATE' Modules/_ScreenSaver_inlines.m:19: warning: initialization makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:21: warning: implicit declaration of function 'PyObjC_INITERROR' Modules/_ScreenSaver_inlines.m:25: warning: implicit declaration of function 'PyObjC_CreateInlineTab' Modules/_ScreenSaver_inlines.m:25: error: 'function_map' undeclared (first use in this function) Modules/_ScreenSaver_inlines.m:25: error: (Each undeclared identifier is reported only once Modules/_ScreenSaver_inlines.m:25: error: for each function it appears in.) Modules/_ScreenSaver_inlines.m:25: warning: passing argument 3 of 'PyModule_AddObject' makes pointer from integer without a cast Modules/_ScreenSaver_inlines.m:29: warning: implicit declaration of function 'PyObjC_INITDONE' lipo: can't open input file: /var/folders/he/healpZWsEkCMBaftAtzVq1OdgRM/-Tmp-//ccgeMtyF.out (No such file or directory) error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1 I'm using Mac OS X 10.6.4 cheers James -- -- James Mills -- -- "Problems are solved by method" From half.italian at gmail.com Wed Nov 3 19:59:57 2010 From: half.italian at gmail.com (Sean DiZazzo) Date: Wed, 3 Nov 2010 11:59:57 -0700 Subject: [Pythonmac-SIG] py2app/wx font embed problem Message-ID: Hi all, I'm trying to package an app for both windows and mac. It uses wxpython, MySQLdb and SQLObject. On Windows, I used py2exe, and got it working right away. On my mac, I have had problems getting it to work. I am using python2.6 on darwin ports along with the needed libraries. When I run the app from the command line using the darwin ports Python version, it opens up ok, and there are no font problems. When I use the same interpreter and package it into a ".app" application, it opens ok, but each text character is replaced by a box. I built the interface with wxFormBuilder, so I am a bit removed from the actual GUI code. I did, though, try changing the default font several different ways and recompiling. It didn't help. Python 2.6.6 (r266:84292, Oct 28 2010, 14:05:04) wx-2.8-gtk2-unicode py2app-0.5.3-py2.6.egg Any ideas? ~Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From aahz at pythoncraft.com Wed Nov 3 20:32:04 2010 From: aahz at pythoncraft.com (Aahz) Date: Wed, 3 Nov 2010 12:32:04 -0700 Subject: [Pythonmac-SIG] py2app/wx font embed problem In-Reply-To: References: Message-ID: <20101103193204.GB688@panix.com> On Wed, Nov 03, 2010, Sean DiZazzo wrote: > > I'm trying to package an app for both windows and mac. It uses wxpython, > MySQLdb and SQLObject. On Windows, I used py2exe, and got it working right > away. On my mac, I have had problems getting it to work. I am using > python2.6 on darwin ports along with the needed libraries. You are likely better off using the python.org build. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair From half.italian at gmail.com Wed Nov 3 20:47:49 2010 From: half.italian at gmail.com (Sean DiZazzo) Date: Wed, 3 Nov 2010 12:47:49 -0700 Subject: [Pythonmac-SIG] py2app/wx font embed problem In-Reply-To: <20101103193204.GB688@panix.com> References: <20101103193204.GB688@panix.com> Message-ID: Ok. Thanks. I'll give it a try (again). I had some problems getting MySQLdb installed previously, so I figured I'd give darwin ports a try...where MySQLdb installed without a hitch. uggh On Wed, Nov 3, 2010 at 12:32 PM, Aahz wrote: > On Wed, Nov 03, 2010, Sean DiZazzo wrote: > > > > I'm trying to package an app for both windows and mac. It uses wxpython, > > MySQLdb and SQLObject. On Windows, I used py2exe, and got it working > right > > away. On my mac, I have had problems getting it to work. I am using > > python2.6 on darwin ports along with the needed libraries. > > You are likely better off using the python.org build. > -- > Aahz (aahz at pythoncraft.com) <*> > http://www.pythoncraft.com/ > > "If you think it's expensive to hire a professional to do the job, wait > until you hire an amateur." --Red Adair > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pedrogazzola at gmail.com Wed Nov 3 21:32:15 2010 From: pedrogazzola at gmail.com (Pedro Gazzola) Date: Wed, 3 Nov 2010 18:32:15 -0200 Subject: [Pythonmac-SIG] Amateur question about modules Message-ID: "ImportError: No module named tkSnack" I tried to run one script on the Python Launcher and got this import error. So, how can I correctly import this module? And where should I put it, so Python can find it. Thanks for any help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From aahz at pythoncraft.com Wed Nov 3 23:10:33 2010 From: aahz at pythoncraft.com (Aahz) Date: Wed, 3 Nov 2010 15:10:33 -0700 Subject: [Pythonmac-SIG] py2app/wx font embed problem In-Reply-To: References: <20101103193204.GB688@panix.com> Message-ID: <20101103221033.GA10749@panix.com> On Wed, Nov 03, 2010, Sean DiZazzo wrote: > > Ok. Thanks. I'll give it a try (again). I had some problems getting > MySQLdb installed previously, so I figured I'd give darwin ports a > try...where MySQLdb installed without a hitch. Yeah, unfortunately my perception is that GUI stuff tends to either require the python.org build or a careful manual build (making sure you get all the framework stuff correct). -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair From kw at codebykevin.com Wed Nov 3 23:30:12 2010 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 03 Nov 2010 18:30:12 -0400 Subject: [Pythonmac-SIG] Amateur question about modules In-Reply-To: References: Message-ID: <4CD1E274.9000306@codebykevin.com> On 11/3/10 4:32 PM, Pedro Gazzola wrote: > "ImportError: No module named tkSnack" > > I tried to run one script on the Python Launcher and got this import error. > > So, how can I correctly import this module? > And where should I put it, so Python can find it. > > Thanks for any help. TkSnack is a Tkinter wrapper for the Snack sound library. You'll need to install TkSnack in your site-packages path and Snack in a place where Tkinter can find it like /Library/Tcl. Google can direct you to download sites. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From klaasmer at gmail.com Mon Nov 1 23:11:36 2010 From: klaasmer at gmail.com (Klaasmer) Date: Mon, 1 Nov 2010 23:11:36 +0100 Subject: [Pythonmac-SIG] os.getcwd() returns lower case current working directory Message-ID: <98B8E796-EEB7-4C19-92B9-200BFED9A799@gmail.com> Hi there, when I call os.getcwd() on my Mac under OS X 10.6.4 from my home directory, the path is converted to lowercase. I get /users/myusername instead of /Users/myusername On another Mac I get the correct uppercase string. How can I configure this? Is there a (hidden) Python setting? Reason for asking: On OS X all user directories are in "/Users". This is always uppercase. When using Mercurial, it gets sometimes confused with this strange and incorrect normalization of my current directory. Best regards, Klaas. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Thu Nov 4 06:07:55 2010 From: nad at acm.org (Ned Deily) Date: Wed, 03 Nov 2010 22:07:55 -0700 Subject: [Pythonmac-SIG] os.getcwd() returns lower case current working directory References: <98B8E796-EEB7-4C19-92B9-200BFED9A799@gmail.com> Message-ID: In article <98B8E796-EEB7-4C19-92B9-200BFED9A799 at gmail.com>, Klaasmer wrote: > when I call os.getcwd() on my Mac under OS X 10.6.4 from my home directory, > the path is converted to lowercase. I get > > /users/myusername > > instead of > > /Users/myusername > > On another Mac I get the correct uppercase string. How can I configure this? > Is there a (hidden) Python setting? > > Reason for asking: On OS X all user directories are in "/Users". This is > always uppercase. When using Mercurial, it gets sometimes confused with this > strange and incorrect normalization of my current directory. [Note to readers here: the OP asked this question also on Stack Overflow and has subsequently found that the same behavior is exhibited by an ObjC program. So it turns out to not be a Python issue at all.] http://stackoverflow.com/questions/4073469/how-can-i-get-the-correct-case -when-calling-pythons-os-getcwd -- Ned Deily, nad at acm.org From half.italian at gmail.com Thu Nov 4 15:58:09 2010 From: half.italian at gmail.com (Sean DiZazzo) Date: Thu, 4 Nov 2010 07:58:09 -0700 Subject: [Pythonmac-SIG] os.getcwd() returns lower case current working directory In-Reply-To: <98B8E796-EEB7-4C19-92B9-200BFED9A799@gmail.com> References: <98B8E796-EEB7-4C19-92B9-200BFED9A799@gmail.com> Message-ID: When formatting a drive last week, I noticed that Mac allows you to format as case-insensitive. Just a guess. On Mon, Nov 1, 2010 at 3:11 PM, Klaasmer wrote: > Hi there, > > when I call os.getcwd() on my Mac under OS X 10.6.4 from my home directory, > the path is converted to lowercase. I get > > /users/myusername > > instead of > > /Users/myusername > > On another Mac I get the correct uppercase string. How can I configure > this? Is there a (hidden) Python setting? > > Reason for asking: On OS X all user directories are in "/Users". This is > always uppercase. When using Mercurial, it gets sometimes confused with this > strange and incorrect normalization of my current directory. > > Best regards, > Klaas. > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rowen at uw.edu Thu Nov 4 18:15:21 2010 From: rowen at uw.edu (Russell E. Owen) Date: Thu, 04 Nov 2010 10:15:21 -0700 Subject: [Pythonmac-SIG] Amateur question about modules References: <4CD1E274.9000306@codebykevin.com> Message-ID: In article <4CD1E274.9000306 at codebykevin.com>, Kevin Walzer wrote: > On 11/3/10 4:32 PM, Pedro Gazzola wrote: > > "ImportError: No module named tkSnack" > > > > I tried to run one script on the Python Launcher and got this import error. > > > > So, how can I correctly import this module? > > And where should I put it, so Python can find it. > > > > Thanks for any help. > > > TkSnack is a Tkinter wrapper for the Snack sound library. You'll need to > install TkSnack in your site-packages path and Snack in a place where > Tkinter can find it like /Library/Tcl. Google can direct you to download > sites. Also be warned: the snack sound library is very outdated. I suggest you look at pygame instead; it has a binary installer and will play sounds. -- Russell From Chris.Barker at noaa.gov Thu Nov 4 18:02:10 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 04 Nov 2010 10:02:10 -0700 Subject: [Pythonmac-SIG] Amateur question about modules In-Reply-To: <4CD1E274.9000306@codebykevin.com> References: <4CD1E274.9000306@codebykevin.com> Message-ID: <4CD2E712.9080107@noaa.gov> On 11/3/10 3:30 PM, Kevin Walzer wrote: >> So, how can I correctly import this module? >> And where should I put it, so Python can find it. > TkSnack is a Tkinter wrapper for the Snack sound library. You'll need to > install TkSnack in your site-packages path and Snack in a place where > Tkinter can find it like /Library/Tcl. Google can direct you to download > sites. Chances are, TkSnack will come as an egg which you can easy_install, or a with a setup.py that will isntall it to the right place for you: python setup.py install Just make sure "python" runs the python you think it does. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From rowen at uw.edu Fri Nov 5 20:23:01 2010 From: rowen at uw.edu (Russell E. Owen) Date: Fri, 05 Nov 2010 12:23:01 -0700 Subject: [Pythonmac-SIG] Amateur question about modules References: <4CD1E274.9000306@codebykevin.com> <4CD2E712.9080107@noaa.gov> Message-ID: In article <4CD2E712.9080107 at noaa.gov>, Christopher Barker wrote: > On 11/3/10 3:30 PM, Kevin Walzer wrote: > >> So, how can I correctly import this module? > >> And where should I put it, so Python can find it. > > > TkSnack is a Tkinter wrapper for the Snack sound library. You'll need to > > install TkSnack in your site-packages path and Snack in a place where > > Tkinter can find it like /Library/Tcl. Google can direct you to download > > sites. > > Chances are, TkSnack will come as an egg which you can easy_install, or > a with a setup.py that will isntall it to the right place for you: > > python setup.py install > > Just make sure "python" runs the python you think it does. > > -Chris Yes. The snack source package does include a python subdirectory with the necessary trivial setup.py file (which I contributed). All it does is copy the one file tkSnack.py to site-packages; you can do that manually if you prefer. Regards, -- Russell From erik at letterror.com Sat Nov 6 12:54:25 2010 From: erik at letterror.com (Erik van Blokland) Date: Sat, 6 Nov 2010 12:54:25 +0100 Subject: [Pythonmac-SIG] __import__('pkg_resources').declare_namespace(__name__) Message-ID: I've found something interesting. When using setuptools-0.6c11-py2.6.egg importing pkg_resources causes Carbon and PyObjCTools to be loaded. With setuptools-0.6c9-py2.6.egg this is not the case. This is relevant in situations where one doesn't want to import OSX API modules before daemonising a process. For instance, when starting a twisted server. I don't know about why the c11 version imports these modules. I'm glad I found a workaround. But the problem is bound to come back. So, any clues to what c11 does that c9 doesn't? Thanks! Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From carles at pina.cat Mon Nov 8 13:35:26 2010 From: carles at pina.cat (Carles Pina i Estany) Date: Mon, 8 Nov 2010 13:35:26 +0100 Subject: [Pythonmac-SIG] Select application version Message-ID: <20101108123526.GA29870@pinux.info> Hello, I'm not an advanced Applescript user, but I usually have a problem: how can I choose the application version that I want my script to connect to? Let's say that I have Microsoft Office 2004, 2008 and 2011. How can I select the version in the tell statement? The final use case is using Python, I thought that appscript.app() could have some argument to specify it, but it seems that it doesn't have any. I also tried appscript.app("Disk:Applications:Microsoft Office 2011:Microsoft Word") without any luck ("Local applicatoin "Disk:Applications:..." not found) Thank you, -- Carles Pina i Estany http://pinux.info From nad at acm.org Mon Nov 8 21:44:08 2010 From: nad at acm.org (Ned Deily) Date: Mon, 08 Nov 2010 12:44:08 -0800 Subject: [Pythonmac-SIG] Select application version References: <20101108123526.GA29870@pinux.info> Message-ID: In article <20101108123526.GA29870 at pinux.info>, Carles Pina i Estany wrote: > I'm not an advanced Applescript user, but I usually have a problem: how can I > choose the application version that I want my script to connect to? > > Let's say that I have Microsoft Office 2004, 2008 and 2011. How can I select > the version in the tell statement? > > The final use case is using Python, I thought that appscript.app() could have > some argument to specify it, but it seems that it doesn't have any. I also > tried appscript.app("Disk:Applications:Microsoft Office 2011:Microsoft Word") > without any luck ("Local applicatoin "Disk:Applications:..." not found) Use a POSIX path to the application: app("/Applications/Microsoft Office 2011/Microsoft Word.app") http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app licationobjects.html -- Ned Deily, nad at acm.org From letterror at gmail.com Fri Nov 5 09:26:26 2010 From: letterror at gmail.com (Erik van Blokland) Date: Fri, 5 Nov 2010 09:26:26 +0100 Subject: [Pythonmac-SIG] __import__('pkg_resources').declare_namespace(__name__) Message-ID: <250AC9DB-3179-4978-A97D-287332D90C38@gmail.com> Hi, Once more looking at the problem that keeps on giving. In short: http://code.activestate.com/lists/pythonmac-sig/22224/ Hard crash flagged with: USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER Background: A helpful person on the twisted.web list found that loading specific modules (pyobjc, Quartz) before a script was daemonized causes OSX 10.6 to crash. He fixed my test script by delaying OSX specific modules until after daemosing. The test script works locally. However, running the same test script on a mac mini server still has the same (or similarly flagged) crash. Both machines have the same python version, OSX version, pyobjc, twisted versions, 64bit, even user ID. Running it remotely via SSH or in a GUI yields the same results, (ssh into local machine, script works, ssh into remote machine, script doesn't work, screensharing into remote machine, script doesn't work) Problem: Another helpful person suggested there might be other modules that get loaded before daemonising. So I dumped sys.modules before and after daemonising, both local and remote, and compared. On the remote machine the MacOS and Carbon modules are loaded before daemonising, on the local machine they're not. (NB, I don't know if these imports are relevant to the Fork crash, but it seems prudent to find out). None of the modules called by my test script call Carbon directly but I found this line in a zope init, (a dependency of twisted) loads Carbon. The cryptic import: __import__('pkg_resources').declare_namespace(__name__) I don't know what this means. Which conditions on the remote machine would cause this line to load Carbon? #Test: import sys def printCarbonLoaded(when): print ("%s carbon is"%when), "Carbon" in sys.modules.keys() printCarbonLoaded("1") __import__('pkg_resources').declare_namespace(__name__) printCarbonLoaded("2") Results: local machine: 1 carbon is False 2 carbon is False remote machine: 1 carbon is False 2 carbon is True Many thanks, Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfjlaw at gmail.com Thu Nov 11 15:01:00 2010 From: mfjlaw at gmail.com (Mark Johannessen) Date: Thu, 11 Nov 2010 06:01:00 -0800 Subject: [Pythonmac-SIG] Searchable digest for this list? Message-ID: Is there a searchable digest for this list? I'm looking to resolve the following error which seems to be tied to appscript: Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug. Mark J From skip at pobox.com Thu Nov 11 17:32:50 2010 From: skip at pobox.com (skip at pobox.com) Date: Thu, 11 Nov 2010 10:32:50 -0600 Subject: [Pythonmac-SIG] Searchable digest for this list? In-Reply-To: References: Message-ID: <19676.6834.701262.721663@montanaro.dyndns.org> Google? Searching for: site:mail.python.org Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug. yielded just two hits. -- Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/ From rowen at uw.edu Fri Nov 12 20:40:59 2010 From: rowen at uw.edu (Russell E. Owen) Date: Fri, 12 Nov 2010 11:40:59 -0800 Subject: [Pythonmac-SIG] bdist_mpkg permissions bug Message-ID: bdist_mpkg 0.4.4 has a nasty habit of making data files unreadable by anyone except the file owner (the umask ends in 00). For example when using bdist_mkpg to make an installer for matplotlib for all files in mpl-data end up with this issue. There is a workaround: let bdist_mpkg run to completion, then delete the mpgk, fix the permissions in the build directory and run bdist_mpkg again. Any idea who (if anyone) maintains this package and what might have changed to cause this problem? Older versions of bdist_mpkg did not exhibit this problem, though I'm not sure exactly when it appeared, nor whether it is in bdist_mpkg itself or a package it relies on. -- Russell From ronaldoussoren at mac.com Tue Nov 16 12:10:30 2010 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 16 Nov 2010 12:10:30 +0100 Subject: [Pythonmac-SIG] Searchable digest for this list? In-Reply-To: References: Message-ID: On 11 Nov, 2010, at 15:01, Mark Johannessen wrote: > Is there a searchable digest for this list? I'm looking to resolve > the following error which seems to be tied to appscript: > > Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() > to debug. You started a new python process using os.fork and didn't call os.exec to start a new executable. Something you did initialized Apple's frameworks in the parent process and you then tried to use them in the child process (through appscript). Apple's Cocoa frameworks don't like this and in 10.6 crash the process with the message you mention. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From i at yaofur.com Thu Nov 18 09:19:27 2010 From: i at yaofur.com (Fur Yao) Date: Thu, 18 Nov 2010 16:19:27 +0800 Subject: [Pythonmac-SIG] How to add appscript module to a pyobjc project? Message-ID: I have some problem In my app , I want to use "appscript" . I use easy_install appscript , and it works well in my python script. But when I build a Mac app in xcode , an error appears. >>> from appscript import app , k ImportError: No module named appscript >>> Then I copy the appscript folder direct from "/Library/Python/2.6/site-packages/appscript-0.21.1-py2.6-macosx-10.6-universal/" to the app's Resources folder. and I also copy aem mactypes.py osax.py And it appears: "ImportError: Bad magic number in /Users/Kebot/git/Giraffa/build/Debug/Giraffa.app/Contents/Resources/appscript/__init__.pyc" Forgive my poor English. -- Blog: http://kebot.me/ More About Me: http://about.me/yaofur/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Thu Nov 18 19:10:57 2010 From: nad at acm.org (Ned Deily) Date: Thu, 18 Nov 2010 10:10:57 -0800 Subject: [Pythonmac-SIG] How to add appscript module to a pyobjc project? References: Message-ID: In article , Fur Yao wrote: > In my app , I want to use "appscript" . > > I use easy_install appscript , and it works well in my python script. > > But when I build a Mac app in xcode , an error appears. > > >>> > from appscript import app , k > ImportError: No module named appscript > >>> > > Then I copy the appscript folder direct from > "/Library/Python/2.6/site-packages/appscript-0.21.1-py2.6-macosx-10.6-universa > l/" > to > the app's Resources folder. > and I also copy aem mactypes.py osax.py > > And it appears: > > "ImportError: Bad magic number in > /Users/Kebot/git/Giraffa/build/Debug/Giraffa.app/Contents/Resources/appscript/ > __init__.pyc" Your Xcode project is apparently using a different version of Python than the one appscript was installed with. If you are on OS X 10.6, you may have the Xcode target set for 10.5 instead of 10.6 and, thus, are using the Apple-supplied python2.5 in your project. For example: $ /usr/bin/python2.6 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ma cpath.pyc $ /usr/bin/python2.5 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ma cpath.pyc RuntimeError: Bad magic number in .pyc file If you do need to support 10.5, try installing appscript with python2.5, too. $ /usr/bin/easy_install-2.5 appscript -- Ned Deily, nad at acm.org From mfjlaw at gmail.com Fri Nov 19 23:47:45 2010 From: mfjlaw at gmail.com (Mark Johannessen) Date: Fri, 19 Nov 2010 14:47:45 -0800 Subject: [Pythonmac-SIG] OS X compatibility of Appscript Message-ID: I think I've tracked down this error to the use of a python Appscript call: The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug. This is on a machine that has: Python 2.6.6 (MacPorts installed) OS X 10.5.8 PPC Appscript 0.21.1 (easy_install-2.6) Django 1.2.3 (using easy_install) Other than pages using Appscript, everything works fine. Am I using the right Appscript? Mark J From erik at letterror.com Sat Nov 20 11:40:43 2010 From: erik at letterror.com (Erik van Blokland) Date: Sat, 20 Nov 2010 11:40:43 +0100 Subject: [Pythonmac-SIG] OS X compatibility of Appscript In-Reply-To: References: Message-ID: <3B737FBA-69F6-4248-8827-531E4DBB9DCC@letterror.com> On Nov 19, 2010, at 11:47 PM, Mark Johannessen wrote: > I think I've tracked down this error to the use of a python Appscript call: > > The process has forked and you cannot use this CoreFoundation > functionality safely. You MUST exec(). > Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() > to debug. This sounds similar to http://mail.python.org/pipermail/pythonmac-sig/2010-October/022705.html OSX 10.6 is a lot stricter than earlier versions about loading OSX API modules before a process is forked. Postponing the imports until after forking is the solution. The 0.6 C11 version of setuptools triggers this exception by loading Carbon on its own. I believe this might have been fixed. A way to find who loads what is to look at sys.modules.keys() at various stages in the program. Erik From Chris.Barker at noaa.gov Mon Nov 29 17:50:39 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 29 Nov 2010 08:50:39 -0800 Subject: [Pythonmac-SIG] 2.7.1 build? Message-ID: <4CF3D9DF.9020107@noaa.gov> Hey folks (or should I say Ronald?), What's up with binary builds for 2.7.1? Python.or has recently released 2.7.1, but there are no mac binaries yet. This wouldn't be a big deal -- I'm patient, but unfortunately the way the python.org web site is set up, it's easy to find 2.7.1, but next to impossible to find 2.7.0 -- they appear to only put in links to the latest minor release. I say "next to impossible", because I haven't found it yet, and I've been poking around the web site for a few minutes. so, we really need either a set of 2.7.1 builds, or at least a link on the python.org site somewhere obvious for the 2.7.0 builds! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From richard.fuhr at gmail.com Mon Nov 29 19:14:57 2010 From: richard.fuhr at gmail.com (Richard Fuhr) Date: Mon, 29 Nov 2010 10:14:57 -0800 Subject: [Pythonmac-SIG] 2.7.1 build? In-Reply-To: <4CF3D9DF.9020107@noaa.gov> References: <4CF3D9DF.9020107@noaa.gov> Message-ID: Here is a link to 2.7 that includes a Mac installer disk image; am also looking forward to the same sort of resource for 2.7.1 http://www.python.org/download/releases/2.7/ On Mon, Nov 29, 2010 at 8:50 AM, Christopher Barker wrote: > Hey folks (or should I say Ronald?), > > What's up with binary builds for 2.7.1? > > Python.or has recently released 2.7.1, but there are no mac binaries yet. > > This wouldn't be a big deal -- I'm patient, but unfortunately the way the > python.org web site is set up, it's easy to find 2.7.1, but next to > impossible to find 2.7.0 -- they appear to only put in links to the latest > minor release. I say "next to impossible", because I haven't found it yet, > and I've been poking around the web site for a few minutes. > > so, we really need either a set of 2.7.1 builds, or at least a link on the > python.org site somewhere obvious for the 2.7.0 builds! > > -Chris > > > > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Mon Nov 29 19:15:59 2010 From: skip at pobox.com (skip at pobox.com) Date: Mon, 29 Nov 2010 12:15:59 -0600 Subject: [Pythonmac-SIG] 2.7.1 build? In-Reply-To: <4CF3D9DF.9020107@noaa.gov> References: <4CF3D9DF.9020107@noaa.gov> Message-ID: <19699.60895.484517.71305@montanaro.dyndns.org> Chris> I say "next to impossible", because I haven't found it yet, and Chris> I've been poking around the web site for a few minutes. Drop the ".0" and I think you've got it: http://www.python.org/download/releases/2.7/ A minor inconsistency in the naming, but traditionally the first micro release of a series doesn't include the ".0". -- Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/ From Chris.Barker at noaa.gov Mon Nov 29 20:01:15 2010 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 29 Nov 2010 11:01:15 -0800 Subject: [Pythonmac-SIG] 2.7.1 build? In-Reply-To: <19699.60895.484517.71305@montanaro.dyndns.org> References: <4CF3D9DF.9020107@noaa.gov> <19699.60895.484517.71305@montanaro.dyndns.org> Message-ID: <4CF3F87B.2060605@noaa.gov> On 11/29/10 10:15 AM, skip at pobox.com wrote: > Drop the ".0" and I think you've got it: > > http://www.python.org/download/releases/2.7/ yup -- thanks Richard and Skip -- thank god for restfull urls! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From ronaldoussoren at mac.com Tue Nov 30 09:11:32 2010 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 30 Nov 2010 09:11:32 +0100 Subject: [Pythonmac-SIG] 2.7.1 build? In-Reply-To: <4CF3D9DF.9020107@noaa.gov> References: <4CF3D9DF.9020107@noaa.gov> Message-ID: <9D053D75-91F5-47D2-9C34-EB9469D23239@mac.com> On 29 Nov, 2010, at 17:50, Christopher Barker wrote: > Hey folks (or should I say Ronald?), > > What's up with binary builds for 2.7.1? > > Python.or has recently released 2.7.1, but there are no mac binaries yet. > > This wouldn't be a big deal -- I'm patient, but unfortunately the way the python.org web site is set up, it's easy to find 2.7.1, but next to impossible to find 2.7.0 -- they appear to only put in links to the latest minor release. I say "next to impossible", because I haven't found it yet, and I've been poking around the web site for a few minutes. > > so, we really need either a set of 2.7.1 builds, or at least a link on the python.org site somewhere obvious for the 2.7.0 builds! I was away offline most of the weekend and will create the 2.7.1 builds later today. Ronald > > -Chris > > > > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG