[Pythonmac-SIG] help! coregraphics+python+webserver suddenly fails
michael geary
listmail at gearyweb.com
Wed Feb 4 22:48:34 CET 2009
Hi Folks,
i have very little experience with anything relating to cocoa, and not
much more with quartz, but i'm an experienced web app developer, and
have used python quite a bit. This list is the closest thing i can
find to a forum where i can discuss this issue.
I have a script that i've been using for a long time to create jpeg
previews of PDF documents, and it recently started failing. Here is
the essence of the script:
-----------------
pdfData =
CGPDFDocumentCreateWithProvider(CGDataProviderCreateWithFilename
(pdfPath))
originalRect = pdfData.getMediaBox(page)
res = float(res)
origWidth, origHeight =
(originalRect.size.width,originalRect.size.height)
width, height = (originalRect.size.width,originalRect.size.height)
newRect = CGRectMake(0,0,width*res/72.0,height*res/72.0)
## set the color space (rgb):
cs = CGColorSpaceCreateWithName(kCGColorSpaceUserRGB)
## set the context (whatever that is). Background color is hardcoded
to white for now:
ctx = CGBitmapContextCreateWithColor(int(newRect.size.width),
int(newRect.size.height),cs, (1, 1, 1, 1))
## draw the image
ctx.drawPDFDocument(newRect, pdfData, page)
## write out the jpeg
ctx.writeToFile(jpegPath, kCGImageFormatJPEG)
----------------
The problem i'm now suddenly getting (i'm on 10.5.6) is on the
drawPDFDocument() call. When i hit that, the following gets logged to
the system log:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python[402]: ATSClient: can't make
connection to ATSServer. bootstrap_look_up status = 268435459
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python[402]: ATSClient: can't re-connect
with ATSServer status = -3182
Python[402]: ATSFontActivateFromMemory failed: error -3182.
Help! Can anyone offer any insights?
thanks,
michael geary
More information about the Pythonmac-SIG
mailing list