|
|
|
|
@ -141,6 +141,29 @@ async def update(
|
|
|
|
|
|
|
|
|
|
await db_session.commit()
|
|
|
|
|
|
|
|
|
|
# Get the directory of the current file
|
|
|
|
|
# directory_path = "../modules/plant"
|
|
|
|
|
directory_path = os.path.abspath(
|
|
|
|
|
os.path.join(os.path.dirname(__file__), "../modules/plant")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Construct path to the script
|
|
|
|
|
script_path = os.path.join(directory_path, "run.py")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
process = await asyncio.create_subprocess_exec(
|
|
|
|
|
"python", script_path, stdout=PIPE, stderr=PIPE, cwd=directory_path
|
|
|
|
|
)
|
|
|
|
|
stdout, stderr = await process.communicate()
|
|
|
|
|
|
|
|
|
|
# Check if the script executed successfully
|
|
|
|
|
if process.returncode != 0:
|
|
|
|
|
print(f"Script execution error: {stderr.decode()}")
|
|
|
|
|
else:
|
|
|
|
|
print(f"Script output: {stdout.decode()}")
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"Error executing script: {e}")
|
|
|
|
|
|
|
|
|
|
return transaction_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|