[Pythonmac-SIG] CFURL Pain

has hengist.podd at virgin.net
Mon Feb 28 19:41:47 CET 2005


Hi folks,

I'm not really up on these APIs nor their Python wrappers, but I 
suspect this stuff is broke:

First try:

import Carbon.CF as CF
f = 
CF.CFURLCreateFromFileSystemRepresentation('file://localhost/Users/has/', 
True)
print f # <CFURL object at 0x000c10e0 for 0x000de810>
print `f.CFURLGetString().toPython()` # 
u'./file://localhost/Users/has' (Where did './' come from?)
print f.toPython() # MacOS.Error: (-192, 'Resource not found')
print f.CFURLGetFSRef() # crashes
print f.CFURLGetFSRef()[1].as_pathname() # MacOS.Error: (-35, 'no such volume')


Second try:

import Carbon.CF as CF
f = CF.toCF('file://localhost/Users/has/').CFURLCreateWithString(None)
print f # <CFURL object at 0x000c10f0 for 0x0004fec0>
print `f.CFURLGetString().toPython()` # u'file://localhost/Users/has/'
print f.toPython() # MacOS.Error: (-192, 'Resource not found')
print f.CFURLGetFSRef() # crashes
print f.CFURLGetFSRef()[1].as_pathname() # crashes


Anyone want to confirm/correct me? (OS10.2.8, MacPython 2.3.3)

has
-- 
http://freespace.virgin.net/hamish.sanderson/


More information about the Pythonmac-SIG mailing list