Hello engineers:
enclosed image shows the errors when I run Python script node,please tell me how to fix this issue.
thanks
Hello engineers:
enclosed image shows the errors when I run Python script node,please tell me how to fix this issue.
@wooddenbowl maybe you can tell us more about the error and about your code. In Windows it seems to work just fine.
import knime.scripting.io as knio
import pandas as pd
from datetime import datetime
# 获取当前日期 (Get the current date)
current_date = datetime.now()
end_date = pd.Timestamp(current_date)
print(end_date)
start_date = end_date - pd.DateOffset(years=1) - pd.offsets.MonthBegin()
print(start_date)
# 创建 pandas DataFrame (Create pandas DataFrame)
date_range_df = pd.DataFrame({
'起始日期': [start_date.strftime('%Y-%m-%d')], # Start Date
'结束日期': [end_date.strftime('%Y-%m-%d')] # End Date
})
knio.output_tables[0] = knio.Table.from_pandas(date_range_df)
Hello mlauber:
thanks for your reply. This problem occurs after I’ve installed models including pillow camelot about parsing PDF to extract tables in it. Maybe I’ve changed numpy that originally embedded in KNIME in this process. instead of re-installing KNIME, is there any way to resolve it?
@wooddenbowl question is which Python environment are you using. You can use the embedded one that should work.
subprocess.check_call([
python_path,
"-m",
"pip",
"install",
"--no-cache-dir",
"numpy==1.26.4",
"pandas==2.2.2",
"-i",
"https://pypi.tuna.tsinghua.edu.cn/simple"
])
``` I've used these codes to resume my python script
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.