I'm trying to upload a file with curl, but I keep running into this one error.
AttributeError: 'unicode' object has no attribute 'file'
I'm on OSX, and the curl command im using looks like this:
curl -d "attach=@`pwd`/output.txt" http://localhost:8081
The app engine code looks like this which is taken from the image share example app.
def post(self):
attachment = self.request.POST.get('attach').file.read()
I'm thinking I may be missing some params regarding the file in the curl command? When I add "type=text/plain" I just get a new error.
AttributeError: 'str' object has no attribute 'file'
I also looked at the blobstore, but this file upload is just going to be passed off onto a mail attachment, so I would rather not have to save the upload to disk.
Edit: I just tried the example in this other question and I get a unicode error, so I convert it to a string, but it doesn't give me the file, just the string that is the path to the file.