You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling AdImage().remote_create(batch=batch); batch.execute() the exception ValueError: I/O operation on closed file is raised.
When using the AdImage().remote_create() I found that this worked as intended and the AdImage object was returned with an 'id' and 'hash', but when attempting to do this while using a batch I ran into the I/O exception.
When looking into a possible fix for this, I tried looking at the AdImage's remote_create function (line number 1366 for me) and noticed that open_file was being closed before the batch could be executed. Commenting out the line that closed the file for the sake of testing made the call complete but an error response {u'error': {u'message': u'File <IMG_PATH> has not been attached', u'type': u'GraphBatchException'}} was returned.
File "/Users/nilesnelson/projects/facebook-python-ads-sdk/facebookads/api.py", line 416, in execute
files=files,
File "/Users/nilesnelson/projects/facebook-python-ads-sdk/facebookads/api.py", line 270, in call
files=files,
File "/Users/nilesnelson/projects/virtualenvs/adroll/lib/python2.7/site-packages/requests/sessions.py", line 443, in request
prep = self.prepare_request(req)
File "/Users/nilesnelson/projects/virtualenvs/adroll/lib/python2.7/site-packages/requests/sessions.py", line 374, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/Users/nilesnelson/projects/virtualenvs/adroll/lib/python2.7/site-packages/requests/models.py", line 307, in prepare
self.prepare_body(data, files, json)
File "/Users/nilesnelson/projects/virtualenvs/adroll/lib/python2.7/site-packages/requests/models.py", line 449, in prepare_body
(body, content_type) = self._encode_files(files, data)
File "/Users/nilesnelson/projects/virtualenvs/adroll/lib/python2.7/site-packages/requests/models.py", line 152, in _encode_files
rf = RequestField(name=k, data=fp.read(),
ValueError: I/O operation on closed file
Here is a test for integration.py that should do the same thing as the script:
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
When calling
AdImage().remote_create(batch=batch); batch.execute()
the exceptionValueError: I/O operation on closed file
is raised.When using the
AdImage().remote_create()
I found that this worked as intended and the AdImage object was returned with an 'id' and 'hash', but when attempting to do this while using a batch I ran into the I/O exception.When looking into a possible fix for this, I tried looking at the AdImage's remote_create function (line number 1366 for me) and noticed that
open_file
was being closed before the batch could be executed. Commenting out the line that closed the file for the sake of testing made the call complete but an error response{u'error': {u'message': u'File <IMG_PATH> has not been attached', u'type': u'GraphBatchException'}}
was returned.Here is the script I started with:
Here is the stack trace that was outputted:
Here is a test for integration.py that should do the same thing as the script:
The text was updated successfully, but these errors were encountered: