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
from scrapy.exporter import XmlItemExporter
class ProductXmlExporter(XmlItemExporter):
def serialize_field(self, field, name, value):
if field == 'price':
return f'$ {str(value)}'
return super(Product, self).serialize_field(field, name, value)
and always get error from command line
return super(Product, self).serialize_field(field, name, value)
TypeError: super(Product, obj): obj must be an instance or subtype of type
Im relatively new to Python, but AFAIK, super function cannot accept Product class, it should be ProductXmlExporter, but when I change it, nothing happens to "price" field in XML export file.
The text was updated successfully, but these errors were encountered:
Im using code from Scrapy documentation - https://docs.scrapy.org/en/latest/topics/exporters.html, with "Product" class item created
and always get error from command line
return super(Product, self).serialize_field(field, name, value)
TypeError: super(Product, obj): obj must be an instance or subtype of type
Im relatively new to Python, but AFAIK, super function cannot accept Product class, it should be ProductXmlExporter, but when I change it, nothing happens to "price" field in XML export file.
The text was updated successfully, but these errors were encountered: