From 3d2ef9879305449568962db9be7fa753473ec11e Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 24 Aug 2020 10:49:58 -0500 Subject: The function draw_rotated_text_ was writing an image to /tmp, which GN2 user apparently doesn't have access to, so I replaced it with a link to the dynamically set TEMPDIR * wqflask/utility/pillow_utils.py - Replaced "/tmp/" in image location with TEMPDIR --- wqflask/utility/pillow_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'wqflask/utility') diff --git a/wqflask/utility/pillow_utils.py b/wqflask/utility/pillow_utils.py index dfbf3e19..0c2ce7af 100644 --- a/wqflask/utility/pillow_utils.py +++ b/wqflask/utility/pillow_utils.py @@ -1,5 +1,7 @@ from PIL import Image, ImageColor, ImageDraw, ImageFont +from utility.tools import TEMPDIR + import utility.logger logger = utility.logger.getLogger(__name__ ) @@ -14,7 +16,7 @@ def draw_rotated_text(canvas, text, font, xy, fill=BLACK, angle=-90): draw_text = ImageDraw.Draw(tmp_img) draw_text.text(text=text, xy=(0,0), font=font, fill=fill) tmp_img2 = tmp_img.rotate(angle, expand=1) - tmp_img2.save("/tmp/{}.png".format(text), format="png") + tmp_img2.save("/{0}/{1}.png".format(TEMPDIR, text), format="png") canvas.paste(im=tmp_img2, box=tuple([int(i) for i in xy])) # def draw_open_polygon(canvas: Image, xy: tuple, fill: ImageColor=WHITE, outline: ImageColor=BLACK): -- cgit v1.2.3 From b3461095a21fd373656156a983038e4a586085a9 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 24 Aug 2020 14:09:26 +0300 Subject: Remove unused imports * wqflask/utility/Plot.py: Remove unused imports like "numarray". "numarray" is does not have py3 support so it's important to remove references to it. --- wqflask/utility/Plot.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'wqflask/utility') diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py index d4373412..b9b71129 100644 --- a/wqflask/utility/Plot.py +++ b/wqflask/utility/Plot.py @@ -26,16 +26,12 @@ from __future__ import print_function -from PIL import (Image, ImageColor, ImageDraw, ImageFont) -from pprint import pformat as pf +from PIL import ImageColor +from PIL import ImageDraw +from PIL import ImageFont from math import * -import random -import sys, os -from numarray import linear_algebra as la -from numarray import ones, array, dot, swapaxes -import webqtlUtil import corestats from base import webqtlConfig from utility.pillow_utils import draw_rotated_text -- cgit v1.2.3