From 2eefc55b6384a23ec517aad16bd2374e086f51d1 Mon Sep 17 00:00:00 2001 From: brn7331 Date: Mon, 1 May 2017 23:46:58 +0200 Subject: [PATCH] increase random in tempfile name added another random variable to the random tempfile name because working with hundreds of qrcode sometimes i got an error --- src/qrtools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qrtools.py b/src/qrtools.py index ad7316c..7aaddb8 100644 --- a/src/qrtools.py +++ b/src/qrtools.py @@ -32,7 +32,7 @@ import Image import re from codecs import BOM_UTF8 - +import random class QR(object): @@ -118,7 +118,7 @@ def __init__( # objects. self.data = data # get a temp directory - self.directory = os.path.join('/tmp', 'qr-%f' % time.time()) + self.directory = os.path.join('/tmp', 'qr-%f-s' % (time.time(), random.randint(999999, 99999999)) self.filename = filename os.makedirs(self.directory)