Skip to content

Commit 07a01aa

Browse files
author
Kieran BW
committed
fix for linux
1 parent 7fd94f4 commit 07a01aa

23 files changed

+17
-7
lines changed

lib/imageEdit.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import glob
99
import re
1010
import os, inspect
11-
THISDIR = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
11+
from pathlib import Path
1212

13+
THISDIR = str(Path(__file__).resolve().parent)
1314

1415
FILE_EXTS = ["png", "jpg"]
1516

@@ -248,10 +249,10 @@ def createDirsIfRequired(filepath):
248249
Args:
249250
filepath (string): full file path or file path relative to /lib
250251
"""
251-
tok = re.split('/|\\\\', filepath)
252+
tok = re.split(os.sep, filepath)
252253
checkfile = ''
253254
for x in tok[:-1]:
254-
checkfile += x + '\\'
255+
checkfile += x + os.sep
255256
os.makedirs(checkfile, exist_ok=True)
256257

257258

@@ -371,7 +372,10 @@ def getSortedColours(image):
371372
def getKey(item):
372373
return item[0]
373374

374-
return sorted(colors, key=getKey, reverse=True)
375+
if colors is not None:
376+
return sorted(colors, key=getKey, reverse=True)
377+
else:
378+
return [(1, (255, 255, 255, 255)), (1, (1, 1, 1, 255))]
375379

376380

377381
def addText(image, text):

main/input/Dungeon2.png

25.2 KB
Loading

main/input/Hangman.png

5.61 KB
Loading

main/input/IRCBot.png

18 KB
Loading

main/input/ImageEncoder.png

7.18 KB
Loading

main/input/ScrapeCookies.png

39.5 KB
Loading

main/input/StegMobile.png

12.4 KB
Loading

main/input/SymEncryptor.png

10.2 KB
Loading
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)