ResourceWarning: unclosed file

155 views
Skip to first unread message

John Boyd

unread,
Nov 15, 2019, 6:52:30 AM11/15/19
to bottlepy
Hello All,

I am a new user of Bottle and I keep getting the following error:

  sys:1: ResourceWarning: unclosed file <_io.BufferedRandom name=5>

I have a form where the client uploads an image, the image gets saved to the image folder correctly.
However when the form reloads and posted again I get the above mentioned error.

My code:

@post('/stockcount')
def database_update():
    sku
= request.forms.get('sku')
    description
= request.forms.get('description')

    image_folder
= 'images/'
    img
= request.files.get('image')
    img
.save(image_folder)

   
return template('views/index.tpl', form=form)


My setup is:
  • Ubuntu 18.04.3 LTS
  • Both Bottle.py stable AND Bottle 13-Dev ( I tried both, got same error)
  • Python 3.6.8
  • Virtualenv

Any help will be greatly appreciated.

Best Regards,
John.

Reply all
Reply to author
Forward
0 new messages