Dodger
-
Posts
8 -
Joined
-
Last visited
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by Dodger
-
-
Well, you did ask
Traceback (most recent call last):File "act.py", line 162, in <module>do_action()File "act.py", line 117, in do_actioncheck = set_tags(tags, path)File "act.py", line 86, in set_tagsbytes = c_char_p(dataToSend.bytes().tobytes())AttributeError: 'buffer' object has no attribute 'tobytes' -
Here you go: 'tagtest' is the tag for the file I'm using.
>>> from Foundation import *>>> from ctypes import *>>> libc = cdll.LoadLibrary("libc.dylib")>>> path = "/Users/theo/Desktop/tagtest.txt".encode("utf-8")>>> cPath = c_char_p(path)>>> data = create_string_buffer(4096)>>> name = "com.apple.metadata:kMDItemOMUserTags".encode("utf-8")>>> dataSize = libc.getxattr(cPath, name, data, 4096, 0, 0x0001)>>> dataSize52>>> nsData = NSData.dataWithBytes_length_(data, dataSize)>>> NSPropertyListSerialization.propertyListWithData_options_format_error_(nsData, kCFPropertyListImmutable, None, None)(tagtest) -
It all goes horribly wrong at datasize:
>>> from Foundation import *>>> from ctypes import *>>> libc = cdll.LoadLibrary("libc.dylib")>>> path = "users/theo/desktop/tagtest.txt" .encode("utf-8")>>> cPath = c_char_p(path)>>> data = create_string_buffer(4096)>>> name = "com.apple.metadata:kMDItemOMUserTags".encode("utf-8")>>> dataSize = libc.getxattr(cPath, name, data, 4096, 0, 0x0001)>>> dataSize-1>>> nsData = NSData.dataWithBytes_length_(data, dataSize)Traceback (most recent call last):File "<stdin>", line 1, in <module>ValueError: NSInvalidArgumentException - *** -[NSConcreteData initWithBytes:length:copy:freeWhenDone:bytesAreVM:]: absurd length: 18446744073709551615, maximum size: 9223372036854775808 bytes -
I tried that and got the same as you, except the ', None' at the end:
<62706c69 73743030 a4010203 0453666f 6f536261 72536261 7a537175 78080d11 15190000 00000000 01010000 00000000 00050000 00000000 00000000 00000000 001d> -
Sorry - another error message:
Traceback (most recent call last):File "act.py", line 155, in <module>do_action()File "act.py", line 110, in do_actioncheck = set_tags(tags, path)File "act.py", line 73, in set_tagskCFPropertyListBinaryFormat_v1_0, NSPropertyListImmutable, None)ValueError: too many values to unpack -
Thanks for the reply. Terminal output for python is:
Python 2.6.1 -
I continually get an error message with this workflow. I'm on 10.6.8. This is the message:
Traceback (most recent call last):File "act.py", line 149, in <module>do_action()File "act.py", line 95, in do_actioncleanPaths = get_finder()File "act.py", line 40, in get_finderpathList = subprocess.check_output(["osascript", "getFinder.applescript"])AttributeError: 'module' object has no attribute 'check_output'I do see the 'gathering tags...' message followed by a list of tags. Any ideas? Thanks.
OpenMeta Tags: Search, tag, open tagged files
in Share your Workflows
Posted
Thank you so much for that - it works perfectly and is very fast. Thanks also for the bonus label setting.