Skip to content

Commit 3e06792

Browse files
FLmingBelval
authored andcommitted
Fix picture path, when using import
1 parent 89e10a3 commit 3e06792

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

trdg/background_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def picture(height, width):
5959
"""
6060
Create a background with a picture
6161
"""
62-
63-
pictures = os.listdir("./pictures")
62+
script_path = os.path.split(os.path.realpath(__file__))[0]
63+
pictures = os.listdir(os.path.join(script_path, "pictures"))
6464

6565
if len(pictures) > 0:
66-
pic = Image.open("./pictures/" + pictures[rnd.randint(0, len(pictures) - 1)])
66+
pic = Image.open(os.path.join(script_path, "pictures", pictures[rnd.randint(0, len(pictures) - 1)]))
6767

6868
if pic.size[0] < width:
6969
pic = pic.resize(

0 commit comments

Comments
 (0)