|
|
|
|
@ -45,8 +45,7 @@ MEDIA_URL = getattr(settings, 'MEDIA_URL', '') |
|
|
|
|
|
|
|
|
|
ORDER_VAR = 'o' |
|
|
|
|
ORDER_TYPE_VAR = 'ot' |
|
|
|
|
# GHOSTSCRIPTCMD = 'gs' |
|
|
|
|
GHOSTSCRIPTCMD = '/usr/bin/gs' |
|
|
|
|
GHOSTSCRIPTCMD = 'gs' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Ordering(object): |
|
|
|
|
@ -402,15 +401,13 @@ class BaseViews(object): |
|
|
|
|
|
|
|
|
|
if not settings.DEBUG: |
|
|
|
|
os.chmod(tmp_dir, 755) |
|
|
|
|
GHOSTSCRIPTCMD = '/usr/bin/gs' |
|
|
|
|
|
|
|
|
|
tmp_dirname = os.path.split(tmp_dir)[1] |
|
|
|
|
|
|
|
|
|
f = open(filename, 'wb') |
|
|
|
|
f.write(pdf) |
|
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
print(filename) |
|
|
|
|
|
|
|
|
|
args = [GHOSTSCRIPTCMD, |
|
|
|
|
"-q", |
|
|
|
|
"-dNOPAUSE", "-dBATCH", "-dSAFER", |
|
|
|
|
@ -420,15 +417,13 @@ class BaseViews(object): |
|
|
|
|
"-f", filename |
|
|
|
|
] |
|
|
|
|
try: |
|
|
|
|
|
|
|
|
|
print("Running command:\n%s" % ' '.join(args)) |
|
|
|
|
|
|
|
|
|
if settings.DEBUG: |
|
|
|
|
print("Running command:\n%s" % ' '.join(args)) |
|
|
|
|
p = s.Popen(args=args, stdout=s.PIPE, stderr=s.PIPE) |
|
|
|
|
p.wait() |
|
|
|
|
except OSError as e: |
|
|
|
|
sys.exit("{}\nError executing Ghostscript {}. " |
|
|
|
|
"Is it in your PATH?".format(e, GHOSTSCRIPTCMD)) |
|
|
|
|
|
|
|
|
|
except: |
|
|
|
|
print("Error while running Ghostscript subprocess. Traceback:") |
|
|
|
|
print("Traceback:\n%s" % traceback.format_exc()) |
|
|
|
|
|