Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-12-01 Thread Henning Hraban Ramm

Am 2008-11-30 um 14:29 schrieb Karsten Wolf:

If I use MacOS.GetCreatorAndType(filename) on my Intel machine, I  
get for an EPS:

('09HF', 'FSPE')


Have you checked that with the tool GetFileInfo? I get those  
reversed types/creators for some files on my PPC machine.


I get the reversed types/creators for *all* files (if they got them at  
all) with MacOS.GetCreatorAndType.


Thanks for the GFI hint - that tool gets it right:

hraban$ GetFileInfo MontageA3.pdf
file: MontageA3.pdf
type: PDF 
creator: CARO
attributes: avbstclinmedz
created: 10/25/2006 15:07:28
modified: 10/25/2006 15:07:28


Seems like some Apps write bogus type/creator fields.


Don't know. Most modern apps don't use type/creator any more at all.


That should read ('FH09', 'EPSF').
I didn't knew endian-ness affects the order of strings.
Very funny! ;-)


It isn't technically a string. More like UInt32. IIRC type/creator  
are stored in big-endian order.


Ok, but how can I convert those Ints to string?
I get them as Ints also from UTGetOSTypeFromString:

 from LaunchServices import UTGetOSTypeFromString
 UTGetOSTypeFromString('public.jpeg')
1886741100


Anyway, the traditional MacOS type and creator would be a nice  
addition. The MacOS module is deprecated. I could ask the Finder  
via appscript, but I wonder if there's a more direct way - I'm  
surprised the mactypes module's Alias and File classes don't know  
type and creator.


There are 2 ways I currently know of:

- via LaunchServices
def get_mac_fileinfo(POSIXPathToFile):
   import LaunchServices as LS
   return LS.GetInfoForPath( POSIXPathToFile, LS.kLSRequestAllInfo)


AttributeError: 'module' object has no attribute 'GetInfoForPath'

Where did you find that function?
I didn't find it in Apple's whole library.



- via a FSSpec which is deprecated since OS 10.4:

def get_mac_fileinfo(POSIXPathToFile):
   import Carbon.File as CF
   finfo = CF.FSSpec( POSIXPathToFile ).FSpGetFInfo()
   return finfo.Creator, finfo.Type, finfo.Flags, finfo.Fldr,  
finfo.Location


The FSRef of doing things would be via FSGetCatalogInfo.  
Unfortunately the FSGetCatalogInfo structure omits the finderInfo  
field.



That works, but I'd prefer a future proof method.


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)




___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Can't convert simple Python script to bundle with py2app

2008-12-01 Thread Christopher Barker

[EMAIL PROTECTED] wrote:


Hmmm...  I just built a framework version.  I configured like so:

../configure --enable-framework='/Users/skip/Applications' \
 --enable-shared --prefix='/Users/skip/local' \
 CPPFLAGS='-I/Users/skip/local/include -I/opt/local/include' \
 LDFLAGS='-L/Users/skip/local/lib -L/opt/local/lib'

No .dylib file was created.



maybe that was a red hearing. I just did a quick look on my system:

$ locate libpython
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libpython.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libpython2.3.dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libpython2.dylib
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config/libpython2.5.a
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/config/libpython2.6.a
/usr/lib/libpython.dylib
/usr/lib/libpython2.3.dylib
/usr/lib/libpython2.dylib

so it looks like things have changed some between 2.3 and 2.5. This is 
an OS-X 10.4 system, so 2.3 is apple's build. 2.5 and 2.6 are the 
python.org Framework builds.


Is there a chance that your py2ap is getting confused about what python 
it is running in?



raise ValueError('%r does not exist' % (pathname,))
ValueError: '/Users/skip/local/lib/libpython2.7.dylib' does not
 exist

You're building a 2.7? what is that? I thought Python was going from 2.6 
to 3.0.



-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

[EMAIL PROTECTED]
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Can't convert simple Python script to bundle with py2app

2008-12-01 Thread Skip Montanaro
  You're building a 2.7? what is that? I thought Python was going from 2.6 to
 3.0.

Building from Subversion trunk identifies itself as 2.7a0.  There will
be a number of
other 2.x versions released more-or-less in parallel with 3.y versions.

Skip
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-12-01 Thread Bill Janssen
Henning Hraban Ramm [EMAIL PROTECTED] wrote:

  from LaunchServices import UTGetOSTypeFromString
  UTGetOSTypeFromString('public.jpeg')
 1886741100

 hex(1886741100)
'0x7075626c'
 chr(0x70), chr(0x75), chr(0x62), chr(0x6c)
('p', 'u', 'b', 'l')
 

Doesn't seem all that useful.

Bill
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-12-01 Thread Henning Hraban Ramm


Am 2008-12-01 um 20:02 schrieb Nicholas Riley:

import LaunchServices
LaunchServices.UTTypeCopyPreferredTagWithClass('public.jpeg',  
LaunchServices.kUTTagClassOSType)

u'JPEG'



Thank you, that's something I might use.

And probably LSFindApplicationForInfo, LSGetApplicationForItem and  
LSCopyApplicationForMIMEType, also from LaunchServices.


(Might these method names perhaps be a little bit inconsistent?)


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)




___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-12-01 Thread Nicholas Riley
On Mon, Dec 01, 2008 at 07:34:37PM +0100, Henning Hraban Ramm wrote:
 Ok, but how can I convert those Ints to string?
 I get them as Ints also from UTGetOSTypeFromString:
 
  from LaunchServices import UTGetOSTypeFromString
  UTGetOSTypeFromString('public.jpeg')
 1886741100

 from LaunchServices import UTGetOSTypeFromString
 ostype = UTGetOSTypeFromString('public.jpeg')
 ('%x' % ostype).decode('hex')
'publ'

I don't think that is what you want though.  Instead, use:

 import LaunchServices
 LaunchServices.UTTypeCopyPreferredTagWithClass('public.jpeg', 
 LaunchServices.kUTTagClassOSType)
u'JPEG'

-- 
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] App distribution with eggs

2008-12-01 Thread Scot Brew


Christopher Barker wrote:
 
 2) py2app works OK with eggs, as longs as the eggs are not zipped. You 
 need to install them with:
 


Uncompressing the .egg works with py2app and MySQLdb.  I had the same issue
and was able to get py2app to correctly build the .app with MySQLdb after
manually unzipping the MySQLdb .egg under site-packages.

Instead of
*  MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg   (as a binary .zip file)

make a MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg directory and uncompress
it

1) mv MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg
MySQL_python-1.2.2-py2.5-macosx-10.3-fat.zip
2) mkdir MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg
3) mv MySQL_python-1.2.2-py2.5-macosx-10.3-fat.zip
MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg
4) cd MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg
5) unzip MySQL_python-1.2.2-py2.5-macosx-10.3-fat.zip

Re-run the py2app and it should pick up the MySQLdb module now as expected.

Scot
-- 
View this message in context: 
http://www.nabble.com/App-distribution-with-eggs-tp20569084p20783552.html
Sent from the Python - pythonmac-sig mailing list archive at Nabble.com.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] PyColourChooser don't works

2008-12-01 Thread Robin Dunn

Mariano Di Felice wrote:
Ok, but  I cannot upgrade my wxpython version, and my object must 
works... Any idea? Can I download only pycolourchooser module (from 
where?) and replace my source?




http://svn.wxwidgets.org/viewvc/wx/wxPython/branches/WX_2_8_BRANCH/wx/lib/colourchooser/

--
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig