diff --git a/run.py b/run.py index bd11018..24ed163 100644 --- a/run.py +++ b/run.py @@ -1,10 +1,11 @@ +# from uvicorn import Config, Server import uvicorn from src.config import PORT, HOST if __name__ == "__main__": uvicorn.run( - "src.main:app", - host=HOST, - port=PORT, - reload=True - ) \ No newline at end of file + "src.main:app", + host=HOST, + port=PORT, + # reload=True + ) diff --git a/src/modules/__pycache__/config.cpython-311.pyc b/src/modules/__pycache__/config.cpython-311.pyc new file mode 100644 index 0000000..8f0efb0 Binary files /dev/null and b/src/modules/__pycache__/config.cpython-311.pyc differ diff --git a/src/modules/plant/wlc.xlsx b/src/modules/plant/wlc.xlsx index df5a581..bdb54b1 100644 Binary files a/src/modules/plant/wlc.xlsx and b/src/modules/plant/wlc.xlsx differ diff --git a/src/plant_transaction_data/__pycache__/router.cpython-311.pyc b/src/plant_transaction_data/__pycache__/router.cpython-311.pyc index d25561d..88ce763 100644 Binary files a/src/plant_transaction_data/__pycache__/router.cpython-311.pyc and b/src/plant_transaction_data/__pycache__/router.cpython-311.pyc differ diff --git a/src/plant_transaction_data/__pycache__/schema.cpython-311.pyc b/src/plant_transaction_data/__pycache__/schema.cpython-311.pyc index 69eab79..721e44c 100644 Binary files a/src/plant_transaction_data/__pycache__/schema.cpython-311.pyc and b/src/plant_transaction_data/__pycache__/schema.cpython-311.pyc differ diff --git a/src/plant_transaction_data/__pycache__/service.cpython-311.pyc b/src/plant_transaction_data/__pycache__/service.cpython-311.pyc index 17e2738..dcf4e2a 100644 Binary files a/src/plant_transaction_data/__pycache__/service.cpython-311.pyc and b/src/plant_transaction_data/__pycache__/service.cpython-311.pyc differ diff --git a/src/plant_transaction_data/service.py b/src/plant_transaction_data/service.py index d8cf11d..027a05d 100644 --- a/src/plant_transaction_data/service.py +++ b/src/plant_transaction_data/service.py @@ -94,37 +94,26 @@ async def create( # 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')) + 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") - if not os.path.exists(script_path): - logger.error(f"Script not found at path: {script_path}") - raise FileNotFoundError(f"Script not found at path: {script_path}") - - # Execute script try: process = await asyncio.create_subprocess_exec( - "python", - script_path, - stdout=PIPE, - stderr=PIPE, - cwd=directory_path + "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: - error_message = stderr.decode() - logger.error(f"Script execution failed: {error_message}") - # Depending on your requirements, you might want to raise an exception here + print(f"Script execution error: {stderr.decode()}") else: - logger.info(f"Script executed successfully: {stdout.decode()}") - - except asyncio.SubprocessError as e: - logger.error(f"Failed to execute script: {e}") - raise Exception(f"Failed to execute script: {e}") - # Handle subprocess error appropriately + print(f"Script output: {stdout.decode()}") + except Exception as e: + print(f"Error executing script: {e}") return transaction_data