Re: [Pythonmac-SIG] Question about py2app packages and includes options
On 18 Jul, 2012, at 0:25, Chris Barker wrote: It's a big ugly, but I've managed to put packages into the zip with something like this: includes = [package, package.subpackage package.subpackage.module1 package.subpackage.module2 ] for some reason (is it a bug? -- or has it been fixed?) doing: includes = [ package.subpackage.module] puts module in the root, so it's there but can't be imported the same way. I don't think this is fixed yet, I've added an item to the py2app tracker for this: https://bitbucket.org/ronaldoussoren/py2app/issue/52 Ronald smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Wed, Jul 18, 2012 at 11:14 AM, Chris Barker chris.bar...@noaa.gov wrote: On Tue, Jul 17, 2012 at 3:49 PM, Michael McCracken michael.mccrac...@gmail.com wrote: That makes sense - but as you mention, it seems like there's some missing functionality. I think so, yes, but it can get the job done. However, it's no fun if you have a lot of subpackages to add that way. nope -- but for the most part they are picked up by regular imports, anyway. You only need to do this if there are some dynamic importing in your code -- and in that case, it's likely you'll want the whole package anyway. In my (probably unusual) situation, it's not dynamic imports: I have these helper apps that I'm including in the main app bundle. I wanted to have their Frameworks and lib directories just be symlinks to the top level, which then had to have the sum of all the modules. The modules the sub-apps use are picked up and put in the zip just fine when they're built separately, but I need to put those modules in the toplevel .zip. I was looking for a nice way to do that from the options, but that's the specific thing that's missing. That said, the code to just directly merge the zips and lib-dynload directories was pretty straightforward and seems to be working well. If anyone else ever has a similar need, I'd be happy to share it. -mike -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Tue, Jul 17, 2012 at 3:49 PM, Michael McCracken michael.mccrac...@gmail.com wrote: That makes sense - but as you mention, it seems like there's some missing functionality. I think so, yes, but it can get the job done. However, it's no fun if you have a lot of subpackages to add that way. nope -- but for the most part they are picked up by regular imports, anyway. You only need to do this if there are some dynamic importing in your code -- and in that case, it's likely you'll want the whole package anyway. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Tue, Jul 17, 2012 at 11:03 AM, Michael McCracken My question is: why does 'packages' copy the package recursively, but not into the .zip, because there are packages that don't work right if zipped -- so this gets around that. while 'includes' only gets single modules? I suspect it's because there should be a way to include a particular module without the whole package. Essentially: includes adds a module to list, just as thought there were an import module name line in the code -- it is used to cover dynamic imports that won't be caught by walking the code. packages makes na compete copy of the package, and puts it outside the zip bundle -- this is fro including packages that have auxiliary files, etc, and/or can't be zipped for other reasons. It's a big ugly, but I've managed to put packages into the zip with something like this: includes = [package, package.subpackage package.subpackage.module1 package.subpackage.module2 ] for some reason (is it a bug? -- or has it been fixed?) doing: includes = [ package.subpackage.module] puts module in the root, so it's there but can't be imported the same way. HTH, - Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question about py2app packages and includes options
On Tue, Jul 17, 2012 at 5:25 PM, Chris Barker chris.bar...@noaa.gov wrote: On Tue, Jul 17, 2012 at 11:03 AM, Michael McCracken My question is: why does 'packages' copy the package recursively, but not into the .zip, because there are packages that don't work right if zipped -- so this gets around that. That makes sense - but as you mention, it seems like there's some missing functionality. while 'includes' only gets single modules? I suspect it's because there should be a way to include a particular module without the whole package. Essentially: includes adds a module to list, just as thought there were an import module name line in the code -- it is used to cover dynamic imports that won't be caught by walking the code. packages makes na compete copy of the package, and puts it outside the zip bundle -- this is fro including packages that have auxiliary files, etc, and/or can't be zipped for other reasons. It's a big ugly, but I've managed to put packages into the zip with something like this: includes = [package, package.subpackage package.subpackage.module1 package.subpackage.module2 ] for some reason (is it a bug? -- or has it been fixed?) doing: includes = [ package.subpackage.module] puts module in the root, so it's there but can't be imported the same way. I don't have time to test, but I think that's been fixed. However, it's no fun if you have a lot of subpackages to add that way. For what it's worth, the approach I'm now taking is to create the full packages for each helper app, then just directly add the missing files in site-packages.zip and lib-dynload from the helper into the main app. Using ZipFile, it's not too bad. I looked at the source for how py2app uses modulegraph, to see if I could just generate the dependencies for the sub apps and pass them as the 'includes' for the main app, but that seemed involved enough that I ended up doing the above. -mike HTH, - Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] question
On Jul 9, 2012, at 7:46 PM, Ed Pataky wrote: i have a mac where i installed python, and tornado web server .. i used py2app and created an executable which wraps my tornado kickoff script into an executable .. works ok sometimes, but i am confused about a couple things: 1) when i run the app, since it is essentially a command line script with no GUI, i see nothing, although i is running ... how can i create the app so that it opens the terminal and shows the output? Strictly speaking you can't without a lot of extra trouble - BUT any print statements in your script will be logged to the system log and is then easily viewable in the Console app in your Utilities folder. 2) sometimes it gets blocked by the firewall and sometimes it does not .. i have manually gone in and added it to he allowed list in the firewall, then as soon as it tries to open a port, the firewall blocks it ... i am not sure how i did it but i got it work a few times, then sometimes it is blocked .. how can i make sure when i run the app, it has full permission without having to mess with the firewall setting ... for example, is there an admin option when making the executable? Could you be a little more specific here - are you opening a port to listen for incoming sessions or are you trying to open an outbound session? Also, exactly which version of the OS are you running? Apple has been locking things down more and more in the progression from 10.6 to 10.7. -Bill ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] Question on appscript's entire_contents() call
Andrew Wu wrote: My team is using py-appscript to do some automated testing (via the UI). We really like the entire_contents() call because it gives us all the UI elements for a given application (as referenced via app('System Events').processes[app_name]). However, entire_contents() seems to return a list, and we lose the advantage of generating complex queries to discover information about a set of objects. Instead we've found ourselves having to iterate over the list and querying each item of interest in the list, which results in a significant performance hit. I have 2 primary questions: a) Is there a way to create complex queries on entire_contents in this context, or am I stuck iterating over the list that is returned? Doesn't look like it. System Events declares the property's type as 'list [of references]'. (Compare with Finder's 'entire contents' property, which is declared as 'reference'.) So you have to retrieve the entire list before you can do anything with it. b) The same operation on the resultant list on Snow Leopard (10.6.3) seems to run 4x slower than on Leopard (10.5.8), discounting hardware differences. Is there a way for me to setup the appscript installation to mitigate this performance hit? Have you tried running 32-bit on both to see if it's a 32-/64-bit issue? Otherwise, I'm guessing any performance hit will be in OS X/System Events, though you'd need to profile your code to be sure. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] question about garbage collection with NSApplication.run()
On 31 May, 2009, at 20:34, Bill Janssen wrote: I'm writing a Python program that has a main that looks like this: application = NSApplication.sharedApplication() # set up handler for network change notification SCDynamicStoreSetNotificationKeys(DYNSTORE, None, [NETWORK_KEY,]) # Get a CFRunLoopSource for our store session and add it to the application's runloop: CFRunLoopAddSource( NSRunLoop.currentRunLoop().getCFRunLoop(), SCDynamicStoreCreateRunLoopSource(None, DYNSTORE, 0), kCFRunLoopCommonModes ) # add a timer for application scan events timer = NSTimer .scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( periodicity, scanner, objc.selector(scanner.scan, signature=v@:), None, True) # using an NSRunLoop avoids Activity Monitor complaining about not responding application.run() Do I need to do anything about NSAutoreleasePools? My understanding is that this is single-threaded, and that NSApplication.run will handle periodic drainage of the default main thread release pool. That's right. NSApplication.run manages the the pool for you. You only have to worry about autorelease pools when you create new threads running Cocoa code, and when you a long time without looping through the eventloop. Ronald smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] question about garbage collection with NSApplication.run()
Thanks, Ronald. Bill Ronald Oussoren ronaldousso...@mac.com wrote: On 31 May, 2009, at 20:34, Bill Janssen wrote: I'm writing a Python program that has a main that looks like this: application = NSApplication.sharedApplication() # set up handler for network change notification SCDynamicStoreSetNotificationKeys(DYNSTORE, None, [NETWORK_KEY,]) # Get a CFRunLoopSource for our store session and add it to the application's runloop: CFRunLoopAddSource( NSRunLoop.currentRunLoop().getCFRunLoop(), SCDynamicStoreCreateRunLoopSource(None, DYNSTORE, 0), kCFRunLoopCommonModes ) # add a timer for application scan events timer = NSTimer .scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( periodicity, scanner, objc.selector(scanner.scan, signature=v@:), None, True) # using an NSRunLoop avoids Activity Monitor complaining about not responding application.run() Do I need to do anything about NSAutoreleasePools? My understanding is that this is single-threaded, and that NSApplication.run will handle periodic drainage of the default main thread release pool. That's right. NSApplication.run manages the the pool for you. You only have to worry about autorelease pools when you create new threads running Cocoa code, and when you a long time without looping through the eventloop. Ronald ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about setup.py build
On 24 Jan, 2007, at 23:26, Bob Ippolito wrote: On 1/24/07, Daniel Lord [EMAIL PROTECTED] wrote: I admit to being a novice at this yet, but I couldn't find anything relevant to this issue on-line: I am trying to build a version of pysqlite that works with sqllite3 : 1. Apple's installed version doesn't work with the latest so I reinstalled 2. sqllite3 won't build shared libs for universal binaries (typical of a lot of linux/UNIX build since the developers never have that problem except on OS X) Why would you want shared libs anyway? I'm pretty sure the Mac build script that comes with Python 2.5 (Mac/BuildScript/build-installer.py) will automatically download SQLite and compile it universally as a static lib. Take a look in there. It does, the sqlite module in the binary distribution for python 2.5 links with our own copy of sqlite because the distribution also works on 10.3 and Apple didn't ship sqlite with that release. I'm also pretty sure that I didn't anything that would make it impossible to build a univeral dynamic library, I use a static lib because that's more convenient. The only reason to use a dylib when building extensions is when you have multiple extensions that link to the same library and share access (that's why the bundles ncurses in py2.5 is a shared library). 3. so I built Intel-only but 4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g - isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc. etc.) with python setup.py build 5. But nowhere in the setup.py or setup.cfg is that set. I explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from there. So where is it being set? By the Python build? Where? I jsut need a little pointer or two and I'll do the rest. Thanks. The same place that everything else that distutils knows about is coming from, the Makefile in your Python library that was created when Python was built: lib/python2.4/config/Makefile Barring bug adding '-arch', 'i386' to the compile and link flags for an extension should do the right thing (that is, distutils will recoginze these flags and remove the default -arch flags when the user specified a specific architecture). Ronald smime.p7s Description: S/MIME cryptographic signature ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about setup.py build
On 1/24/07, Daniel Lord [EMAIL PROTECTED] wrote: I admit to being a novice at this yet, but I couldn't find anything relevant to this issue on-line: I am trying to build a version of pysqlite that works with sqllite3 : 1. Apple's installed version doesn't work with the latest so I reinstalled 2. sqllite3 won't build shared libs for universal binaries (typical of a lot of linux/UNIX build since the developers never have that problem except on OS X) Why would you want shared libs anyway? I'm pretty sure the Mac build script that comes with Python 2.5 (Mac/BuildScript/build-installer.py) will automatically download SQLite and compile it universally as a static lib. Take a look in there. 3. so I built Intel-only but 4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g - isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc. etc.) with python setup.py build 5. But nowhere in the setup.py or setup.cfg is that set. I explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from there. So where is it being set? By the Python build? Where? I jsut need a little pointer or two and I'll do the rest. Thanks. The same place that everything else that distutils knows about is coming from, the Makefile in your Python library that was created when Python was built: lib/python2.4/config/Makefile -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about setup.py build
Thanks Bob, coming through as always. Daniel On Jan 24, 2007, at 14:26, Bob Ippolito wrote: On 1/24/07, Daniel Lord [EMAIL PROTECTED] wrote: I admit to being a novice at this yet, but I couldn't find anything relevant to this issue on-line: I am trying to build a version of pysqlite that works with sqllite3 : 1. Apple's installed version doesn't work with the latest so I reinstalled 2. sqllite3 won't build shared libs for universal binaries (typical of a lot of linux/UNIX build since the developers never have that problem except on OS X) Why would you want shared libs anyway? I'm pretty sure the Mac build script that comes with Python 2.5 (Mac/BuildScript/build-installer.py) will automatically download SQLite and compile it universally as a static lib. Take a look in there. 3. so I built Intel-only but 4. pysqlite keeps trying to build a universal build (CFLAGS=-O -g - isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc; etc. etc.) with python setup.py build 5. But nowhere in the setup.py or setup.cfg is that set. I explicitly unset CFLAGS and LDFLAGS to ensure it wasn't coming from there. So where is it being set? By the Python build? Where? I jsut need a little pointer or two and I'll do the rest. Thanks. The same place that everything else that distutils knows about is coming from, the Makefile in your Python library that was created when Python was built: lib/python2.4/config/Makefile -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about setup.py build
I realized I only copied Bob on this and to send it out to everyone might help someone else the build for PySQLite is poorly designed and ignores the state of '-- enable-shared' and looks for the dylib anyway so fails on static-only builds. I will have to hack it to get it to work. Shame, shame. On Jan 24, 2007, at 15:08, Daniel Lord wrote: Bob, Just so you know though, I was building the dynamic libs because the installer looks for them even if you disable shared libs. Bad design. So I'll have to 'hack' it to make it work. Not that that isn't business as usual with OS X ;-) [EMAIL PROTECTED] sudo make install Password: tclsh ./tclinstaller.tcl 3.3 couldn't open .libs/libtclsqlite3.dylib: no such file or directory while executing open $LIBFILE invoked from within set in [open $LIBFILE] (file ./tclinstaller.tcl line 23) make: *** [tcl_install] Error 1 [ ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on Python 2.5 and CoreGraphics
On 1/7/07, Robert Love [EMAIL PROTECTED] wrote: Back in 2005 I had a python script that did some simple image manipulation with CoreGraphics. Since then I have upgraded to python 2.5 and the script no longer works. I think you all tried to explain this to me when I upgraded but didn't follow what was being said. CoreGraphics is a proprietary extension distributed (only) by Apple. Source is not available, and it can not be used with any distribution of Python except the one that ships with Mac OS X. -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on Python 2.5 and CoreGraphics
CoreGraphics wrapped by Apple using the built-in Python (Python 2.3 in Tiger). The binding itself is binary and proprietary, so it can only be used with the built-in Python. NodeBox, which appears to be a clone of DrawBot (which was inspired by Processing, etc.) has a library for CoreImage. Robert Kern wrote a wrapper for CoreGraphics which is part of Kiva (http://code.enthought.com/kiva/). He split it off as a standalone package, but the URL I have for that no longer works (problems at Starship Python). I have a copy of an early version (version 0.0.0) which I can send you if you like. I believe it uses Pyrex to build the extension. HTH --Dethe On 7-Jan-07, at 10:39 AM, Robert Love wrote: Back in 2005 I had a python script that did some simple image manipulation with CoreGraphics. Since then I have upgraded to python 2.5 and the script no longer works. I think you all tried to explain this to me when I upgraded but didn't follow what was being said. I'm running a PPC machine with 10.4. which python /Library/Frameworks/Python.framework/Versions/Current/bin/python and ls -l /Library/Frameworks/Python.framework/Versions/Current/bin/ python lrwxr-xr-x 1 root admin 9 Sep 22 23:58 /Library/Frameworks/ Python.framework/Versions/Current/bin/python - python2.5 running the script python mine.py arguments Traceback (most recent call last): File mine.py, line 8, in module from CoreGraphics import * ImportError: No module named CoreGraphics If I use python2.3 mine.py arguments it works as expected. which python2.3 /usr/bin/python2.3 Is there a way to use CoreGraphics with python 2.5? Do I need to install more? Link libraries? ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig There's a little bit of God in every truck driver and a little bit of truck driver in every God. -- Blayne Horner ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about 2.5 beta
Ronald Oussoren wrote: The installer is a mpkg, when you customize the installation you can avoid installing the profile changes and unix tools. The package names should be fairly obvious. Also, python2.3 python2.4 python2.5 should still be available. That's why I like to put: #!/usr/bin/env python2.4 In my #! lines. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] question about ic.py on Mac OS X
On Sat, May 20, 2006 at 09:21:06PM -0400, Ishwinder Kaur Banga wrote: MAC OS version 10.4.6 Python Version 2.4.1 Problem is that the url is valid but the python icglue tells me that it is not found Are you on PPC or x86? Does this happen with the current Python 2.4.3 or the built-in Python 2.3.5? Does this happen when opening URLs using Launch Services, or with Internet Config in other apps? (You can try my 'launch' tool - with the -l option it uses IC, without it, it uses LS). -- Nicholas Riley [EMAIL PROTECTED] | http://www.uiuc.edu/ph/www/njriley ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on user's directory ( ~ )
import os.path os.path.expanduser('~') you da man! That works perfectly. I mostly use Python on WinXP, so I haven't been familiar with that function up until now. It's a common problem... I ran into that once when I was moving an PC based Python application over to MOSX... I knew there was a way expand it, but forgot that it wasn't automagically performed... - Ben ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on user's directory ( ~ )
The tilde is just UNIX shorthand for the environment variable, home. You can access environment variables in python like this: os.getenv(HOME) Scott On Mar 18, 2006, at 4:22 PM, Stewart Midwinter wrote: I have a question on use of the tilde symbol (~) to access the current user's home directory. If you are in a bash shell, you can cd ~ and be in the default user's home directory. I want my python app to be able to switch to the user's directory. But I can't use os.chdir('~') since Python doesn't understand the tilde. Nor can I do this: file = os.path.join('~', filename) What options do I have? thanks S ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on user's directory ( ~ )
Try this: import os.path os.path.expanduser('~') You might also find a use for os.path.expandvars() Kent -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stewart Midwinter Sent: Saturday, March 18, 2006 7:22 PM To: pythonmac-sig@python.org Subject: [Pythonmac-SIG] Question on user's directory ( ~ ) I have a question on use of the tilde symbol (~) to access the current user's home directory. If you are in a bash shell, you can cd ~ and be in the default user's home directory. I want my python app to be able to switch to the user's directory. But I can't use os.chdir('~') since Python doesn't understand the tilde. Nor can I do this: file = os.path.join('~', filename) What options do I have? thanks S ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question on user's directory ( ~ )
On 3/18/06, Kent Quirk [EMAIL PROTECTED] wrote: Try this: import os.path os.path.expanduser('~') you da man! That works perfectly. I mostly use Python on WinXP, so I haven't been familiar with that function up until now. thanks again S ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] Question about Pil and icns...
On Dec 22, 2004, at 7:09 PM, whamoo wrote: I've read that new beta of the Pil now add support for icns file format, nice, but in the code of the plugin i read that there is only the read support, so, i cannot convert icns in other format and vice-versa? And if i load icns, work on it, then i cannot save. Can someone tell me something about it? Someone have tried? That is correct, this is read-only support. You may not save icns files with the code in PIL. You could of course do it the native way, using Mac APIs, or just by dragging images into Icon Composer. My use case was that I had application resources in the canonical Mac OS X formats, and I wanted to re-use them in a Windows port of the software... so I wrote an icns decoder for these files (I used the 128x128 version of the icon in the UI), and all the string localization support from Foundation. I did of course need regular windows .ico files for the applications, but typically they only go up to 48x48, so I still wanted to re-use my .icns file rather than maintain a separate png of 128x128 for the UI. Needless to say, I did not need write support for ico, since all of my source icons were in icns format. What I would've liked is Windows XP .ico writing support, but I couldn't find that (or sufficient docs to implement it) *anywhere* and I ended up using a commercial package on Win32 to do it in batch. -bob ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig