Skip to content

Error when uploading spectrum #80

@moira-andrews

Description

@moira-andrews

When trying to upload a spectrum, I got the following error:

snex2_1     | 2025-09-18T16:29:39.937839069Z 2025-09-18 16:29:39.898    ERROR:             log: Internal Server Error: /custom-data-upload/
snex2_1     | 2025-09-18T16:29:39.937891034Z Traceback (most recent call last):
snex2_1     | 2025-09-18T16:29:39.937895144Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 2055, in get_prep_value
snex2_1     | 2025-09-18T16:29:39.937898841Z     return int(value)
snex2_1     | 2025-09-18T16:29:39.937901632Z ValueError: invalid literal for int() with base 10: ''
snex2_1     | 2025-09-18T16:29:39.937904369Z 
snex2_1     | 2025-09-18T16:29:39.937907016Z The above exception was the direct cause of the following exception:
snex2_1     | 2025-09-18T16:29:39.937909872Z 
snex2_1     | 2025-09-18T16:29:39.937912478Z Traceback (most recent call last):
snex2_1     | 2025-09-18T16:29:39.937915056Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
snex2_1     | 2025-09-18T16:29:39.937931165Z     response = get_response(request)
snex2_1     | 2025-09-18T16:29:39.937934401Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 199, in _get_response
snex2_1     | 2025-09-18T16:29:39.937937193Z     response = self.process_exception_by_middleware(e, request)
snex2_1     | 2025-09-18T16:29:39.937940040Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 362, in process_exception_by_middleware
snex2_1     | 2025-09-18T16:29:39.937943253Z     response = middleware_method(request, exception)
snex2_1     | 2025-09-18T16:29:39.937945958Z   File "/usr/local/lib/python3.9/site-packages/tom_common/middleware.py", line 29, in process_exception
snex2_1     | 2025-09-18T16:29:39.937963479Z     raise exception
snex2_1     | 2025-09-18T16:29:39.937966635Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
snex2_1     | 2025-09-18T16:29:39.937969409Z     response = wrapped_callback(request, *callback_args, **callback_kwargs)
snex2_1     | 2025-09-18T16:29:39.938011776Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 104, in view
snex2_1     | 2025-09-18T16:29:39.938024486Z     return self.dispatch(request, *args, **kwargs)
snex2_1     | 2025-09-18T16:29:39.938027430Z   File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
snex2_1     | 2025-09-18T16:29:39.938030138Z     return super().dispatch(request, *args, **kwargs)
snex2_1     | 2025-09-18T16:29:39.938032657Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 143, in dispatch
snex2_1     | 2025-09-18T16:29:39.938035495Z     return handler(request, *args, **kwargs)
snex2_1     | 2025-09-18T16:29:39.938038167Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/edit.py", line 151, in post
snex2_1     | 2025-09-18T16:29:39.938040927Z     form = self.get_form()
snex2_1     | 2025-09-18T16:29:39.938043542Z   File "/usr/local/lib/python3.9/site-packages/tom_dataproducts/views.py", line 178, in get_form
snex2_1     | 2025-09-18T16:29:39.938046232Z     form = super().get_form(*args, **kwargs)
snex2_1     | 2025-09-18T16:29:39.938048837Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/edit.py", line 39, in get_form
snex2_1     | 2025-09-18T16:29:39.938053144Z     return form_class(**self.get_form_kwargs())
snex2_1     | 2025-09-18T16:29:39.938055707Z   File "/snex2/custom_code/forms.py", line 275, in __init__
snex2_1     | 2025-09-18T16:29:39.938058415Z     self.fields['used_in'] = forms.ModelChoiceField(queryset=Papers.objects.filter(target=target), required=False)
snex2_1     | 2025-09-18T16:29:39.938061207Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 87, in manager_method
snex2_1     | 2025-09-18T16:29:39.938064152Z     return getattr(self.get_queryset(), name)(*args, **kwargs)
snex2_1     | 2025-09-18T16:29:39.938066837Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1436, in filter
snex2_1     | 2025-09-18T16:29:39.938069617Z     return self._filter_or_exclude(False, args, kwargs)
snex2_1     | 2025-09-18T16:29:39.938072076Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1454, in _filter_or_exclude
snex2_1     | 2025-09-18T16:29:39.938074707Z     clone._filter_or_exclude_inplace(negate, args, kwargs)
snex2_1     | 2025-09-18T16:29:39.938082141Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1461, in _filter_or_exclude_inplace
snex2_1     | 2025-09-18T16:29:39.938115785Z     self._query.add_q(Q(*args, **kwargs))
snex2_1     | 2025-09-18T16:29:39.938118988Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1498, in add_q
snex2_1     | 2025-09-18T16:29:39.938121850Z     clause, _ = self._add_q(q_object, self.used_aliases)
snex2_1     | 2025-09-18T16:29:39.938124308Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1529, in _add_q
snex2_1     | 2025-09-18T16:29:39.938131289Z     child_clause, needed_inner = self.build_filter(
snex2_1     | 2025-09-18T16:29:39.938133924Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1444, in build_filter
snex2_1     | 2025-09-18T16:29:39.938136767Z     condition = self.build_lookup(lookups, col, value)
snex2_1     | 2025-09-18T16:29:39.938139239Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1271, in build_lookup
snex2_1     | 2025-09-18T16:29:39.938141847Z     lookup = lookup_class(lhs, rhs)
snex2_1     | 2025-09-18T16:29:39.938144399Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/lookups.py", line 27, in __init__
snex2_1     | 2025-09-18T16:29:39.938147082Z     self.rhs = self.get_prep_lookup()
snex2_1     | 2025-09-18T16:29:39.938149519Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/related_lookups.py", line 166, in get_prep_lookup
snex2_1     | 2025-09-18T16:29:39.938152352Z     self.rhs = target_field.get_prep_value(self.rhs)
snex2_1     | 2025-09-18T16:29:39.938154821Z   File "/usr/local/lib/python3.9/site-packages/django/db/models/fields/__init__.py", line 2057, in get_prep_value
snex2_1     | 2025-09-18T16:29:39.938157512Z     raise e.__class__(
snex2_1     | 2025-09-18T16:29:39.938160061Z ValueError: Field 'id' expected a number but got ''.

The spectrum is a wavelength flux ascii file with the following instrument information:
Instrument: LRS2
Reducer: Greg Zreimann
Telescope: HET
Exp Time: 3600
Date observed: 2025-09-09 07:32:36
Slit (IFU, but put 1 and it failed)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions