MayoMayn
BestDev
- Oct 18, 2016
- 1,423
- 683
Okay, so basically we're using PHP to setup a dynamic Python script where the variables will be changing from request to request depending on the equation the user want's solved.
Currently when producing the script, I'm using \r\n and \n to define indentations.
Unfortunately this doesn't work because of Pythons weird indentation syntax.
How do I make it possible for this script to be run in the SageMath CLI?
Example on how some of the script is being produced:
Currently when producing the script, I'm using \r\n and \n to define indentations.
Unfortunately this doesn't work because of Pythons weird indentation syntax.
How do I make it possible for this script to be run in the SageMath CLI?
You must be registered for see links
Example on how some of the script is being produced:
PHP:
public function addTimeout($callback) {
$this->cmd .= "\ndef solveEquation(): \n";
$callback->bindTo($this)->__invoke();
$this->cmd .= "\np = multiprocessing.Process(target=solveEquation, name='Solve Equation'); \n";
$this->cmd .= "p.start(); \n";
$this->cmd .= "p.join(".$this->timeout.");\n";
$this->cmd .= "if p.is_alive(): \n";
$this->cmd .= " print 'terminated' \n";
$this->cmd .= " p.terminate() \n";
$this->cmd .= " p.join();\n";
}