1. Chris AtLee
  2. poster
  3. Issues
Issue #17 new

ValueError: I/O operation on closed file in OpenSuSe/Windows while Multi-part encoding

Anonymous created an issue


there is a Problem while encoding a file in OpenSuSe and Windows, I tested it in Ubuntu and it works without a problem.

Any help will be very appreciated, thanks

Python 2.7, Poster 0.8.1


datagen, headers = multipart_encode(body) File "/usr/local/lib/python2.7/site-packages/poster/encode.py", line 411, in multipart_encode headers = get_headers(params, boundary) File "/usr/local/lib/python2.7/site-packages/poster/encode.py", line 311, in get_headers headers['Content-Length'] = str(get_body_size(params, boundary)) File "/usr/local/lib/python2.7/site-packages/poster/encode.py", line 302, in get_body_size size = sum(p.get_size(boundary) for p in MultipartParam.from_params(params)) File "/usr/local/lib/python2.7/site-packages/poster/encode.py", line 177, in from_params filetype=filetype, fileobj=value)) File "/usr/local/lib/python2.7/site-packages/poster/encode.py", line 108, in init self.filesize = os.fstat(fileobj.fileno()).st_size ValueError: I/O operation on closed file

Comments (1)

  1. Chris AtLee repo owner

    (Reply via ch...@atlee.ca):

    Can you send some sample code that exhibits this problem? It's hard to tell from the stack trace, but I suspect that perhaps the same file object is being used multiple places?

  2. Log in to comment