algorithmiaio/algorithmia-python

putFile should accept either a path or file object

Opened this issue · 3 comments

Is putFile no longer supported? Readme still has putFile in the sample code for uploading files.

op = client.dir('s3+label://path')
op.putFile('Jellyfish.jpg')
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'DataDirectory' object has no attribute 'putFile'

putFile is supported but the documentation was not accurate. That has been corrected with e2d4a58. @JanakiJoshi, in your code you need to get a File object first to call the putFile method

This bug was created because putFile can only take a file path instead of a file object. In my opinion, it's nice forcing a path since it ensures that the user cannot accidentally give us a handle that is in the middle or end of the file. The downside is that the user cannot use any 'file-like' objects

We are still considering whether its capabilities should be broadened.