Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'os.path.expanduser' func create the temp dir question #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions MyQR/myqr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import tempfile
import os
from MyQR.mylibs import theqrmodule
from PIL import Image
Expand Down Expand Up @@ -84,8 +85,9 @@ def combine(ver, qr_name, bg_name, colorized, contrast, brightness, save_dir, sa
qr_name = os.path.join(save_dir, os.path.splitext(os.path.basename(bg_name))[0] + '_qrcode.png') if not save_name else os.path.join(save_dir, save_name)
qr.resize((qr.size[0]*3, qr.size[1]*3)).save(qr_name)
return qr_name

tempdir = os.path.join(os.path.expanduser('~'), '.myqr')


tempdir = os.path.join(tempfile.gettempdir(), '.myqr')

try:
if not os.path.exists(tempdir):
Expand Down Expand Up @@ -129,4 +131,4 @@ def combine(ver, qr_name, bg_name, colorized, contrast, brightness, save_dir, sa
finally:
import shutil
if os.path.exists(tempdir):
shutil.rmtree(tempdir)
shutil.rmtree(tempdir)