2012-04-01 14:08:44 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#from http://kaioa.com/node/42
|
|
|
|
|
2014-02-06 19:43:19 -08:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2012-04-01 14:08:44 +01:00
|
|
|
import os, subprocess, sys
|
|
|
|
|
2014-02-06 19:43:19 -08:00
|
|
|
|
2012-04-01 14:08:44 +01:00
|
|
|
def run(*args):
|
2014-02-06 19:43:19 -08:00
|
|
|
print("inkscape", end=" ")
|
2012-04-01 14:08:44 +01:00
|
|
|
for arg in args:
|
2014-02-06 19:43:19 -08:00
|
|
|
print(arg, end=" ")
|
|
|
|
print()
|
2012-12-24 16:13:35 +00:00
|
|
|
run = subprocess.Popen(["inkscape"] + list(args) + [" -z"], shell = False, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
2012-04-01 14:08:44 +01:00
|
|
|
out,err=[e.splitlines() for e in run.communicate()]
|
|
|
|
return run.returncode, out, err
|
|
|
|
|
|
|
|
if __name__=='__main__':
|
|
|
|
r = run(sys.argv[1:])
|
|
|
|
if not r[0]==0:
|
2014-02-06 19:43:19 -08:00
|
|
|
print('return code:', r[0])
|
2012-04-01 14:08:44 +01:00
|
|
|
for l in r[1]:
|
2014-02-06 19:43:19 -08:00
|
|
|
print(l)
|
2012-04-01 14:08:44 +01:00
|
|
|
for l in r[2]:
|
2014-02-06 19:43:19 -08:00
|
|
|
print(l)
|