Jump to content

Dodger

Member
  • Posts

    8
  • Joined

  • Last visited

Dodger's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. Thank you so much for that - it works perfectly and is very fast. Thanks also for the bonus label setting.
  2. 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_action check = set_tags(tags, path) File "act.py", line 86, in set_tags bytes = c_char_p(dataToSend.bytes().tobytes()) AttributeError: 'buffer' object has no attribute 'tobytes'
  3. 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) >>> dataSize 52 >>> nsData = NSData.dataWithBytes_length_(data, dataSize) >>> NSPropertyListSerialization.propertyListWithData_options_format_error_(nsData, kCFPropertyListImmutable, None, None) ( tagtest )
  4. 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
  5. 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>
  6. 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_action check = set_tags(tags, path) File "act.py", line 73, in set_tags kCFPropertyListBinaryFormat_v1_0, NSPropertyListImmutable, None) ValueError: too many values to unpack
  7. Thanks for the reply. Terminal output for python is: Python 2.6.1
  8. 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_action cleanPaths = get_finder() File "act.py", line 40, in get_finder pathList = 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.
×
×
  • Create New...