【发布时间】:2022-09-28 18:22:08
【问题描述】:
我正在尝试以下代码,其中我也想使用在 try catch 之外声明的变量。但是我得到了在赋值错误之前引用的局部变量 \'data_summary\'。
以下是我的代码。
data_summary, spdj_count, mstar_count, fs_count, dataframe_ricToMsarId, ricMissingPerformanceIds, dataframe_total_cases_count, dataframe_soi1_case_count, dataframe_soi_2_case_count, dataframe_soi_3_case_count, totalperfIdBoB, dataframe_treasury_check, treasuryEmailSummary, dataframe_fs_mapping_error, fsMissingPerformanceIds, dataframe_total_cases_count, dataframe_soi1_case_count, dataframe_soi_2_case_count, dataframe_soi_3_case_count, totalBoBperfIds
try:
data_summary, spdj_count, msar_count, fs_count = app.compare_floats(env, running_locally, region)
except Exception as exp:
print(\"Error while executing Report-- execute_compare_price - CE_API_Weekly -- Message -- \" + str(exp))
try:
dataframe_ricToMstarId, ricMissingPerformanceIds, dataframe_total_cases_count, dataframe_soi1_case_count, dataframe_soi_2_case_count, dataframe_soi_3_case_count, totalperfIdBoB = app.getMissingRICPerformanceIDsReportDetails(
env, running_locally, region)
except Exception as exp:
print(\"Error while executing Report-- execute_compare_price - CE_API_Weekly -- Message -- \" + str(exp))
try:
dataframe_treasury_check, treasuryEmailSummary = app.getTreasuryDetails(env,
running_locally,
region)
except Exception as exp:
print(\"Error while executing Report-- execute_compare_price - CE_API_Weekly -- Message -- \" + str(exp))
try:
dataframe_fs_mapping_error, fsMissingPerformanceIds, dataframe_total_cases_count, dataframe_soi1_case_count, dataframe_soi_2_case_count, dataframe_soi_3_case_count, totalBoBperfIds = app.getFactsetMappingErrorReportDetails(
env, running_locally, region)
except Exception as exp:
print(\"Error while executing Report-- execute_compare_price - CE_API_Weekly -- Message -- \" + str(exp))
if dataframe_treasury_check > 0 or (ricMissingPerformanceIds > 0 and dataframe_ricToMstarId) > 0 or (
fsMissingPerformanceIds > 0 and dataframe_fs_mapping_error) or (
spdj_count > 0 or mstar_count > 0 or fs_count > 0) > 0:
ricToMstarMappingEmailSummary = reporting.printRICMissingPerformanceIDReportEmailSummary(
dataframe_total_cases_count,
dataframe_soi1_case_count,
dataframe_soi_2_case_count,
dataframe_soi_3_case_count,
有人可以帮忙吗?
-
您的代码无效,甚至不会通过解释器的语法检查,因此无法从该代码中获取运行时错误。请先提供有效代码。
标签: python