I have this gmt script named map.csh, this file will create a map. I want to run/execute it(map.csh) using python. I tried using subprocess.call but I got an error, "Exec format error"
import subprocess
subprocess.call(['./map.csh'])
I have this gmt script named map.csh, this file will create a map. I want to run/execute it(map.csh) using python. I tried using subprocess.call but I got an error, "Exec format error"
import subprocess
subprocess.call(['./map.csh'])
The first line of your script does not appear to be a shebang, since you know it is csh you can use env
to invoke it for you. Like,
subprocess.call(['/usr/bin/env','csh','./map.csh'])
This will search for csh
(it could be /bin/csh
, /usr/bin/csh
, etc).
I still recommend specifying a proper shebang as the first line of map.csh
#!/usr/bin/env csh
as that would follow the principle of least surprise.