I'm trying to add an attachment to a testcaseresult using pyral like this:

```
   testCaseResult = rally.create('TestCaseResult', {'TestCase': tc.ref , 'Build': revision,
                          'Verdict': verdict[test.result], 'Date': resultdate, 'Notes': note,
                          'Tester': tester, 'Duration': runtime })

   res = rally.addAttachment(testCaseResult.oid, file);

```

The TestaseResult is successfully created but res is False.

What am I doing wrong? Should I not be using the oid? I've tried passing testCaseResult, testCaseResult.oid and "TestCaseResult/" + testCaseResult.oid, and none seem to work...

UPDATED:

Based on Mark's answer below (pyral does not directly support adding attachments to testcaseresults), I wrote the following subroutine:

```
def addTestCaseResultAttachment(testCaseResult, filename, contentType='text/plain'):
    if not os.path.exists(filename):
        raise Exception('Named attachment filename: %s not found' % filename)
    if not os.path.isfile(filename):
        raise Exception('Named attachment filename: %s is not a regular file' % filename)

    attachment_file_name = os.path.basename(filename)
    attachment_file_size = os.path.getsize(filename)

    if attachment_file_size == 0:
        raise Exception('Cannot attach zero length file')

    if attachment_file_size > 5000000:
        raise Exception('Attachment file size too large, unable to attach to Rally Artifact')

    contents = ''
    with open(filename, 'r') as af:
        contents = base64.encodestring(af.read())

    # create an AttachmentContent item
    ac = rally.create('AttachmentContent', {"Content" : contents}, project=None)
    if not ac:
        raise RallyRESTAPIError('Unable to create AttachmentContent for %s' % attachment_file_name)

    attachment_info = { "Name"              :  attachment_file_name,
                        "Content"           :  ac.ref,       # ref to AttachmentContent
                        "ContentType"       :  contentType,
                        "Size"              :  attachment_file_size, # must be size before encoding!!
                        "User"              :  'user/%s' % me.oid,
                        "TestCaseResult"    :  testCaseResult.ref
                      }

    # and finally, create the Attachment
    attachment = rally.create('Attachment', attachment_info, project=None)
    if not attachment:
        raise RallyRESTAPIError('Unable to create Attachment for %s' % attachment_file_name)

```