Open
Description
Hi there!
I have and issue creating and export job using celery.
Each time I'm getting this error: TypeError: str() argument 'encoding' must be str, not tuple
Stack Trace:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 453, in trace_task
R = retval = fun(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/utils.py", line 1730, in runner
return sentry_patched_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/celery/__init__.py", line 406, in _inner
reraise(*exc_info)
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/utils.py", line 1659, in reraise
raise value
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/celery/__init__.py", line 401, in _inner
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 736, in __protected_call__
return self.run(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/import_export_celery/tasks.py", line 220, in run_export_job
class Resource(resource_class):
TypeError: str() argument 'encoding' must be str, not tuple
Here is my configurations for ModelResource:
class OdlExportForISOResource(resources.ModelResource):
code = Field(
attribute='code',
column_name='Codice',
widget=CharWidget()
)
state = Field(
attribute='state',
column_name='Stato',
widget=ChoicesWidget(
choices=ODL_STATES
)
)
creation_date = Field(
attribute='creation_date',
column_name='Data Apertura',
widget=DateTimeWidget(format='%d/%m/%Y')
)
data_primo_intervento = Field(
attribute='data_primo_intervento',
column_name='Data Primo Intervento',
widget=DateTimeWidget(format='%d/%m/%Y')
)
closing_date = Field(
attribute='closing_date',
column_name='Data Chiusura',
widget=DateTimeWidget(format='%d/%m/%Y')
)
tipologia = Field(
attribute='tipologia',
column_name='Tipologia',
widget=CharWidget()
)
in_garanzia = Field(
attribute='in_garanzia',
column_name='In Garanzia',
widget=BooleanWidget()
)
rapporto_fgas = Field(
attribute='rapporto_fgas',
column_name='Rapporto FGAS',
widget=BooleanWidget()
)
soddisfazione_cliente = Field(
attribute='soddisfazione_cliente',
column_name='Soddisfazione Cliente',
widget=CharWidget()
)
class Meta:
name= 'Esporta gli ODL per la ISO'
model = Odl
fields = [
'code',
'state',
'creation_date',
'data_primo_intervento',
'closing_date',
'tipologia',
'in_garanzia',
'rapporto_fgas',
'soddisfazione_cliente'
]
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.prefetch_related(
'odl_intervention_reports',
'odl_type'
)
return queryset
This is a classmethod:
@classmethod
def export_resource_classes(cls):
return {
'odl': ('ODL Export for ISO Resource', 'odl.resources.OdlExportForISOResource'),
}
Metadata
Metadata
Assignees
Labels
No labels