请求内容无效,无法反序列化:'之后 解析值时遇到意外字符:进一步研究这个错误,我发现从笔记本中收到一个错误:
---------------------------------------------------------------------------\nValueError Traceback (most recent call last)\n/tmp/ipykernel_10465/628309876.py in <module>\n 7 \n 8 \n----> 9 split_df.columns = ['dot1', 'dot2', 'dot3', 'dot4', 'dot5']\n 10 print(split_df)\n\n~/cluster-env/env/lib/python3.8/site-packages/pandas/core/generic.py in __setattr__(self, name, value)\n 5476 try:\n 5477 object.__getattribute__(self, name)\n-> 5478 return object.__setattr__(self, name, value)\n 5479 except AttributeError:\n 5480 pass\n\npandas/_libs/properties.pyx in pandas._libs.properties.AxisProperty.__set__()\n\n~/cluster-env/env/lib/python3.8/site-packages/pandas/core/generic.py in _set_axis(self, axis, labels)\n 668 def _set_axis(self, axis: int, labels: Index) -> None:\n 669 labels = ensure_index(labels)\n--> 670 self._mgr.set_axis(axis, labels)\n 671 self._clear_item_cache()\n 672 \n\n~/cluster-env/env/lib/python3.8/site-packages/pandas/core/internals/managers.py in set_axis(self, axis, new_labels)\n 218 \n 219 if new_len != old_len:\n--> 220 raise ValueError(\n 221 f\"Length mismatch: Expected axis has {old_len} elements, new \"\n 222 f\"values have {new_len} elements\"\n\nValueError: Length mismatch: Expected axis has 9 elements, new values have 5 elements"
当我将此错误发送到网络活动以发送电子邮件时,我收到上述网络活动错误。尝试过的解决方案:
因此,为了克服这个错误,我使用表达式创建了一个变量“ErrorMessage”,它将首先保存错误消息:
@activity('Notebook1').error.Message
然后另一个变量变量('CleanErrorMessage')将保存干净的消息替换
到 '',使用
@replace(variables('ErrorMessage'),'\n','')
但它没有按预期工作你能帮我解决这个问题,并从笔记本错误消息中删除这个特殊符号和换行符,以便我可以将错误以 json 格式传递给 Web 活动并获取结果。
网络活动 Json:
{
"Pipeline":"@{pipeline().Pipeline}",
"ErrorMessage": "@{variables('CleanErrorMessage')}",
"DataFactoryName":"@{pipeline().DataFactory}",
"Runid":"@{pipeline().RunId}"
}
@string(replace(activity('Notebook1').error.Message, '"',''''))