fix: 修复打包后exe程序在无控制台模式下运行时的uvicorn日志配置错误
通过检测sys.frozen判断运行环境,只在打包后的exe程序中禁用日志配置, 避免AttributeError: 'NoneType' object has no attribute 'isatty'错误。 普通Python运行环境保留完整日志功能,方便调试。
This commit is contained in:
@@ -50,12 +50,20 @@ def create_template():
|
||||
]
|
||||
df_cables = pd.DataFrame(cable_data)
|
||||
|
||||
# Create System Parameters data
|
||||
param_data = [
|
||||
{'Parameter': 'Voltage (kV) / 电压 (kV)', 'Value': 66},
|
||||
{'Parameter': 'Power Factor / 功率因数', 'Value': 0.95}
|
||||
]
|
||||
df_params = pd.DataFrame(param_data)
|
||||
|
||||
# Save to Excel
|
||||
output_file = 'coordinates.xlsx'
|
||||
output_file = 'windfarm_template.xlsx'
|
||||
with pd.ExcelWriter(output_file) as writer:
|
||||
df.to_excel(writer, sheet_name='Coordinates', index=False)
|
||||
df_cables.to_excel(writer, sheet_name='Cables', index=False)
|
||||
print(f"Created sample file: {output_file} with sheets 'Coordinates' and 'Cables'")
|
||||
df_params.to_excel(writer, sheet_name='Parameters', index=False)
|
||||
print(f"Created sample file: {output_file} with sheets 'Coordinates', 'Cables', and 'Parameters'")
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_template()
|
||||
Reference in New Issue
Block a user