Running math equations in Python to save sketch space

I’m trying to get my python script to write a value to the bridge, run some equations, and then put it back into the bridge for the Arduino, but for some reason, I keep returning blank values in the Console until I execute the script manually in Putty. I can see that the sketch is executing mathtest.py in top.

What am I doing wrong?

In the sketch:

#include <Bridge.h>
char ppmCO[10];
int ValSamp = 292;

void setup() {;
  Bridge.begin();
  delay(2000);
  Console.begin();
  Console.println("You're connected to the Console!!!!");
  Console.buffer(64);
}

void loop() {
  Bridge.put("ValsampCOput", String(ValSamp));
  Console.println("Sending");
  delay(1000);
  Process p;        // Create a process and call it "p"
  p.runShellCommand("python mathtest.py"); // Add the URL parameter to "curl"
  Console.println("Processing");
  delay(1000);
 Bridge.get("ValsampCOlin",ppmCO,10);
 Console.println("Getting");
 Console.println(ppmCO);

In python:

#!/usr/bin/python

import math
import sys    

sys.path.insert(0, '/usr/lib/python2.7/bridge/') 
                                                
from bridgeclient import BridgeClient as bridgeclient

valsampCO = bridgeclient() 
val = int(valsampCO.get('ValsampCOput'));
Vrl = val * ( 5.000 / 1024.000  ); 
Rs = 5300.000 * ( 5.000 - Vrl) / Vrl; 
ratio =  (Rs/ 3100.140) 
ppm = str(round(666.340 * math.pow (ratio, -3105.000/1000.000),4));
valsampCO.put('ValsampCOlin',ppm) 
print valsampCO.get('ValsampCOlin')
nano /mnt/sda1/mathtest.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import math
import sys    
ValsampCOput=sys.argv[1]
val = int(ValsampCOput)
Vrl = val * ( 5.0 / 1024.0  )
Rs = 5300.000 * ( 5.0 - Vrl) / Vrl
ratio =  (Rs/ 3100.14) 
ppm = int(round(666.34 * math.pow (ratio, -3105.0/1000.0),4))
print ppm
chmod 755 /mnt/sda1/mathtest.py

test code:

/mnt/sda1/mathtest.py 292
7
#include <Process.h>
int ValSamp = 292;
void setup() {
  // Initialize Bridge
  Bridge.begin();
  // Initialize Serial
  Serial.begin(9600);
  // Wait until a Serial Monitor is connected.
  while (!Serial);
}

void loop() {
  Process p;        // Create a process and call it "p"
  p.begin("/mnt/sda1/mathtest.py");  // Process that launch the "mathtest.py" command
  p.addParameter(String(ValSamp)); // Add the URL parameter to "mathtest.py"
  p.run();      // Run the process and wait for its termination
  while (p.running()); // do nothing until the process finishes, so you get the whole output
  int result = p.parseInt();
  Serial.println((result));
  delay(1000);
}