Error

cannot access local variable 'yearstart' where it is not associated with a value

Details

    Traceback (most recent call last):
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/indexes/extension.py", line 161, in map
    result = mapper(self)
             ^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/acc_bpt/ps/shared/script_ps_intensity_integrated.py", line 174, in 
    data['week_number'] = data['datetime'].apply(lambda x: week(x))
                                                           ^^^^^^^
  File "/opt/acc-bpt/release_2024_03/acc_bpt/ps/shared/script_ps_intensity_integrated.py", line 170, in week
    timediff = datesarg - yearstart
                          ^^^^^^^^^
UnboundLocalError: cannot access local variable 'yearstart' where it is not associated with a value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/acc-bpt/release_2024_03/jinja/build_static_plots.py", line 85, in _create_static_html_content
    output_html_file_path = driver.build(abs_plot_dest_file_html)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/acc_bpt/shared/BptV2.py", line 303, in build
    raise ex
  File "/opt/acc-bpt/release_2024_03/acc_bpt/shared/BptV2.py", line 282, in build
    name, content = self.bptStatic.create_bokeh_model(analyzed_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/acc_bpt/ps/shared/script_ps_intensity_integrated.py", line 174, in create_bokeh_model
    data['week_number'] = data['datetime'].apply(lambda x: week(x))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/series.py", line 4771, in apply
    return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/apply.py", line 1123, in apply
    return self.apply_standard()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/apply.py", line 1171, in apply_standard
    mapped = obj._values.map(f)
             ^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/arrays/_mixins.py", line 85, in method
    return meth(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py", line 821, in map
    return Index(self).map(mapper).array
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/indexes/extension.py", line 171, in map
    return self.astype(object).map(mapper)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 6361, in map
    new_values = self._map_values(mapper, na_action=na_action)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/acc-bpt/release_2024_03/venv/lib/python3.11/site-packages/pandas/core/base.py", line 890, in _map_values
    new_values = map_f(values, mapper)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "pandas/_libs/lib.pyx", line 2924, in pandas._libs.lib.map_infer
  File "/opt/acc-bpt/release_2024_03/acc_bpt/ps/shared/script_ps_intensity_integrated.py", line 174, in 
    data['week_number'] = data['datetime'].apply(lambda x: week(x))
                                                           ^^^^^^^
  File "/opt/acc-bpt/release_2024_03/acc_bpt/ps/shared/script_ps_intensity_integrated.py", line 170, in week
    timediff = datesarg - yearstart
                          ^^^^^^^^^
UnboundLocalError: cannot access local variable 'yearstart' where it is not associated with a value

    

Generated 2024-04-16 18:04:34.933715+02:00