1 -> I have a folder with the path lca_llm\python_scripts. it is used for storing python scripts for generating moelcular properties from PADELPY.
2-> within here there are two files :
a test file: testpadel.py
from padelpy import from_smiles
Define the SMILES string
smiles = "CCCO"
Generate the descriptors for the given SMILES string
descriptors = from_smiles(smiles)
Print the first 5 descriptors
first_5_descriptors = {key: descriptors[key] for key in list(descriptors)[:5]}
print(first_5_descriptors)
3- > and an api call that posts a smiles to :
import sys
import json
from padelpy import from_smiles
def generate_padel_descriptors(smiles):
try:
# Generate PaDEL descriptors
descriptors = from_smiles(smiles)
# Convert all values to float where possible, otherwise keep as string
for key, value in descriptors.items():
try:
descriptors[key] = float(value)
except ValueError:
pass # Keep as string if can't convert to float
return json.dumps(descriptors)
except Exception as e:
return json.dumps({"error": f"Failed to generate PaDEL descriptors: {str(e)}"})
if name == "main":
if len(sys.argv) != 2:
print(json.dumps({"error": "Please provide a SMILES string as an argument"}))
else:
print(generate_padel_descriptors(sys.argv[1]))
- here is the problem, when i activate my environment and run each file they work. they generate the descriptors. the descriptor generation process requires the formation of a csv. When I run my web application using AXUM RUST, the csv can no longer be creasted which is used to generate the descriptors. Why does the Python script work when executed directly from the command line, but fails when called from the Rust application. The main issue seems to be related to file permissions or the working directory when the script is called from Rust.