开发者

Python appscript error: OSERROR: -1700, Can't make some data into the expected type

开发者 https://www.devze.com 2023-03-27 23:48 出处:网络
from appscript import * ps = app(\"Adobe Photoshop CS5\") s = ps.current_document.save s._labelledargterms
from appscript import *
ps = app("Adobe Photoshop CS5")
s = ps.current_document.save
s._labelledargterms

Gives:

{'appending': 'DcXt',
 'as_': 'fltp',
 'copying': 'SaCp',
 'in_': 'kfil',
 'with_options': 'FmOp'}

I'm not exactly use what the kfil means. Can someone explain?

I was trying to do the following:

import mactypes
f = mactypes.File("foo.jpg")
s(as_=k.JPEG, in_=f)

This gives me:

CommandError: C开发者_JAVA技巧ommand failed:
        OSERROR: -1700
        MESSAGE: Can't make some data into the expected type.
        COMMAND: app(u'/Applications/Adobe Photoshop CS5/Adobe Photoshop CS5.app').current_document.save(in_=mactypes.File(u'/Users/az/foo.jpg'), as_=k.JPEG)


Ok, seems I must avoid mactypes.File. Strangely, this works:

s(in_="/Users/az/foo.jpg", as_=k.JPEG,
  with_options={k.class_:k.JPEG_save_options, k.quality:12},
  copying=True, appending=k.no_extension)

I don't fully understand why that works (and not the other way as in the question), so if someone could explain further, that would be great.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号