diff --git a/pym/desktop/desktop.py b/pym/desktop/desktop.py index 9f8cf4f..e127e4e 100644 --- a/pym/desktop/desktop.py +++ b/pym/desktop/desktop.py @@ -110,6 +110,7 @@ class Desktop(MethodsInterface): # если нет шифрованных данных if not path.exists(ecryptfsPath): tf = None + remove_files = None try: # если профиль содержит только данные от бутстрапа core if isBootstrapDataOnly(userDir): @@ -142,7 +143,7 @@ class Desktop(MethodsInterface): if e.failed(): raise DesktopError(e.read()) # если были данные от бутстрапа, то распаковать их - if tf: + if tf and remove_files: with tarfile.open(fileobj=tf, mode='r:') as tarf: tarf.extractall(userDir) except Exception as e: @@ -153,9 +154,10 @@ class Desktop(MethodsInterface): bakArchName = path.join(userDir, ".calculate.tar.bz2") with open(bakArchName, 'w') as f: f.write(tf.read()) - raise DesktopError(str(e) + - _( - "Failed to create an encrypted user profile")) + raise DesktopError( + "%s\n%s" % + (str(e), + _("Failed to create an encrypted user profile"))) finally: if tf: tf.close()