Import of products fails when an image is missing (404 HTTP Error)

Bug #1210543 reported by Grzegorz Grzelak (OpenGLOBE.pl) on 2013-08-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Connector - Magento
Medium
Unassigned

Bug Description

After Product Import I have a lot of such Failures:

What it would be?

openerp.addons.magentoerpconnect.unit.import_synchronizer.import_record('magento.product.product', 1, 299)

Traceback (most recent call last): File "/home/gg/addons-70-custom/connector/queue/worker.py", line 121, in run_job job.perform(session) File "/home/gg/addons-70-custom/connector/queue/job.py", line 460, in perform self.result = self.func(session, *self.args, **self.kwargs) File "/home/gg/addons-70-custom/magentoerpconnect/unit/import_synchronizer.py", line 311, in import_record importer.run(magento_id, force=force) File "/home/gg/addons-70-custom/magentoerpconnect/unit/import_synchronizer.py", line 172, in run self._after_import(binding_id) File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 350, in _after_import image_importer.run(self.magento_id, binding_id) File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 282, in run binary = self._get_binary_image(main_image_data) File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 273, in _get_binary_image binary = urllib2.urlopen(url) File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 406, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 519, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 444, in error return self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 404: Not Found

Related branches

The reason would be that we don't have access to jpg?

2013-08-09 14:15:12,078 14969 DEBUG v70_ff_20130809_migrated_01 openerp.addons.magentoerpconnect.unit.import_synchronizer: magento.product.product 250 created from magento 374
2013-08-09 14:15:13,353 14969 DEBUG v70_ff_20130809_migrated_01 openerp.addons.magentoerpconnect.unit.backend_adapter: api.call(product_media.list, [374, None, 'id']) returned [{'url': 'http://testsystem.xxxxxxxxxxx.de/media/catalog/product/R/i/Rinder_Rumpsteak_2_St.jpg', 'label': 'Rinder Rumpsteak 2 St', 'file': '/R/i/Rinder_Rumpsteak_2_St.jpg', 'position': '3', 'exclude': '0', 'types': ['image', 'small_image', 'thumbnail']}]
2013-08-09 14:15:13,753 14969 ERROR v70_ff_20130809_migrated_01 openerp.addons.connector.queue.worker: Traceback (most recent call last):
  File "/home/gg/addons-70-custom/connector/queue/worker.py", line 121, in run_job
    job.perform(session)
  File "/home/gg/addons-70-custom/connector/queue/job.py", line 460, in perform
    self.result = self.func(session, *self.args, **self.kwargs)
  File "/home/gg/addons-70-custom/magentoerpconnect/unit/import_synchronizer.py", line 311, in import_record
    importer.run(magento_id, force=force)
  File "/home/gg/addons-70-custom/magentoerpconnect/unit/import_synchronizer.py", line 172, in run
    self._after_import(binding_id)
  File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 350, in _after_import
    image_importer.run(self.magento_id, binding_id)
  File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 282, in run
    binary = self._get_binary_image(main_image_data)
  File "/home/gg/addons-70-custom/magentoerpconnect/product.py", line 273, in _get_binary_image
    binary = urllib2.urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found

That's when it imports the images of the Magento products. It happens that the image configured on these products do not exist.

This is something to fix: we should skip them if they do not exist.

Changed in openerp-connector:
status: New → Confirmed
importance: Undecided → Medium
summary: - Binary file in Product prblem
+ Import of products fails when an image is missing (404 HTTP Error)
Changed in openerp-connector:
status: Confirmed → Fix Committed
information type: Embargoed → Public
affects: openerp-connector → openerp-connector-magento

Fix released en 2.2.1

Changed in openerp-connector-magento:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers