Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putFile should accept either a path or file object #7

Open
pmcq opened this issue Dec 28, 2016 · 3 comments
Open

putFile should accept either a path or file object #7

pmcq opened this issue Dec 28, 2016 · 3 comments

Comments

@pmcq
Copy link
Contributor

pmcq commented Dec 28, 2016

Currently only accepts a path and errors on a file
https://github.com/algorithmiaio/algorithmia-python/blob/master/Algorithmia/datafile.py#L95-L102

@JanakiJoshi
Copy link

JanakiJoshi commented Jun 25, 2018

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'

@peckjon peckjon closed this as completed Jun 25, 2018
@peckjon peckjon reopened this Jun 25, 2018
@jamesatha
Copy link
Contributor

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

@jamesatha
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants