通过shell脚本传递WKT变量

My variable is failing to pass through a shell execution, the variable is a WKT. I want to pass so I can you the variable in python. Or how can I convert a WKB to a WKT ?

I am reading a geometry from the database, the value is in a WKB format

PHP code...

$str = pg_query($conn, "SELECT ST_AsText(geom) As geoms FROM villages WHERE setlname = '$city'") or die ("Data loading failed: ".pg_last_error());
...
...
$geom = $data['geoms'];
$output = shell_exec("/usr/bin/python Results.py  $geom");

Python...

def geomRead(): 
   geom = sys.argv[1]
   #Or how do I get the geom as wkb & convert it to wkt once it has been passed
   print geom 

def main(): 
   geomRead() 

if __name__ == '__main__':
   main()

Once the value has been passed to python, I want to do some calculation, get the area and do zonal statistics. Currently I am getting a null results.