Код: Выделить всё
#!/opt/local/bin/python3
import applescript,xattr,os
#This works: applescript.AppleScript('say "Hello AppleScript"').run()
#This works: applescript.AppleScript('display dialog "Hello AppleScript"').run()
AScmd = '''
tell application "Finder"
set TmpLoc to POSIX file "/Volumes/vData/Users/pkearns/tmp" as alias
get comment of TmpLoc
end tell
'''
print("Running this: %s" % AScmd) ;
CurrComment = applescript.AppleScript.run(AScmd).out
print("Comments: %s" % CurrComment)
Код: Выделить всё
Running this:
tell application "Finder"
set TmpLoc to POSIX file "/Volumes/vData/Users/pkearns/tmp" as alias
get comment of TmpLoc
end tell
Traceback (most recent call last):
File "/Volumes/vData/Users/pkearns/tmp/./test-get-comments.py", line 13, in
CurrComment = applescript.AppleScript.run(AScmd).out
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/applescript/__init__.py", line 90, in run
return self._unpackresult(*self._script.executeAndReturnError_(None))
^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute '_unpackresult'
Кто-нибудь видел эту проблему и нашел решение?
Подробнее здесь: https://stackoverflow.com/questions/798 ... -attribute
Мобильная версия