Jump to content

Dodger

Member
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Dodger

  1. 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'
  2. 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
    )
  3. 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
  4. 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
  5. 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...