0

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'])
Dot Dot
  • 19
  • 2

1 Answers1

1

The first line of your script does not appear to be a shebang, since you know it is 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.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249