0

I'm using ParsePy (https://github.com/milesrichardson/ParsePy) and now I'm having a problem with File delete.

from parse_rest.datatypes import Object, File

class GameScore(Object):
    pass

with open('/path/to/screenshot.png', 'rb') as fh:
    rawdata = fh.read()

screenshotFile = File('arbitraryNameOfFile', rawdata, 'image/png')
screenshotFile.save()

gs = GameScore.Query.get(objectId='xxxxxxx')
gs.screenshot = screenshotFile
gs.save()

#
# In another function
#
class GameScore(Object):
    pass

gs = GameScore.Query.get(objectId='xxxxxxx')
gs.screenshot.delete()

# Error: No JSON object could be decoded

Any suggestion? Thanks in advance. Loris

Loris
  • 2,128
  • 2
  • 9
  • 8
  • Looks like the server answered with invalid JSON. You should debug the response using curl and see answer from the server: `curl -X DELETE -H "X-Parse-Application-Id: ${APPLICATION_ID}" -H "X-Parse-Master-Key: ${MASTER_KEY}" https://YOUR.PARSE-SERVER.HERE/parse/files/arbitaryNameOfFile.png`. Name of your file may have prefix to avoid name collisions. To get real file name use `gs.screenshot.name` – Shmygol Nov 09 '17 at 10:39
  • File deleted without response by curl. In my opinion this is the problem! Thanks for your reply. – Loris Nov 10 '17 at 14:34
  • What was a response status? If it was 200, than it's a client bug, which expects JSON, but must only check a response status. The question is why only you experience such a problem? Do you have either old client or an old server? Consider to post an issue in the Github repository of parsepy. – Shmygol Nov 10 '17 at 15:32

0 Answers0