rpa-suite 0.9.1__tar.gz → 0.9.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/PKG-INFO +4 -4
  2. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/README.md +3 -3
  3. rpa_suite-0.9.3/rpa_suite/clock/scheduler.py +36 -0
  4. rpa_suite-0.9.3/rpa_suite/file/temp_dir.py +171 -0
  5. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/suite.py +5 -3
  6. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite.egg-info/PKG-INFO +4 -4
  7. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite.egg-info/SOURCES.txt +1 -0
  8. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/setup.py +1 -1
  9. rpa_suite-0.9.1/rpa_suite/file/temp_dir.py +0 -161
  10. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/LICENSE +0 -0
  11. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/__init__.py +0 -0
  12. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/clock/__init__.py +0 -0
  13. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/clock/exec_at.py +0 -0
  14. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/clock/waiter.py +0 -0
  15. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/date/__init__.py +0 -0
  16. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/date/date.py +0 -0
  17. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/email/__init__.py +0 -0
  18. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/email/sender_smtp.py +0 -0
  19. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/file/__init__.py +0 -0
  20. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/file/counter.py +0 -0
  21. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/log/__init__.py +0 -0
  22. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/log/loggin.py +0 -0
  23. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/log/printer.py +0 -0
  24. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/regex/__init__.py +0 -0
  25. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/regex/list_from_text.py +0 -0
  26. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/validate/__init__.py +0 -0
  27. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/validate/mail_validator.py +0 -0
  28. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite/validate/string_validator.py +0 -0
  29. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite.egg-info/dependency_links.txt +0 -0
  30. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite.egg-info/requires.txt +0 -0
  31. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/rpa_suite.egg-info/top_level.txt +0 -0
  32. {rpa_suite-0.9.1 → rpa_suite-0.9.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa_suite
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.
5
5
  Author: Camilo Costa de Carvalho
6
6
  Author-email: camilo.carvalho@triasoftware.com.br
@@ -134,11 +134,11 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
134
134
  - **waiter** - Funções para aguardar em relação a execução de uma função, podendo ser antes ou depois
135
135
  - **exec_at** - Funções para executar em momentos pré determinados
136
136
  - **date**
137
- - **date** - Funções para capturar data, mes, ano, hora, minutos de forma individual em apenas uma linha
137
+ - **date** - Funções para capturar data, mês, ano, hora, minutos de forma individual em apenas uma linha
138
138
  - **email**
139
139
  - **sender_smtp** - Funções para envio de email SMPT
140
140
  - **file**
141
- - **counter** - Funções para contagens
141
+ - **counter** - Funções para contagem de arquivos
142
142
  - **temp_dir** - Funções para diretórios temporários
143
143
  - **log**
144
144
  - **loggin** - Funções decoradoras com log de execução das funções
@@ -150,7 +150,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
150
150
  - **string_validator** - Funções para validação/varredura (strings, substrings, palavras)
151
151
 
152
152
  ## Release
153
- Versão: **Alpha 0.9.1**
153
+ Versão: **Alpha 0.9.3**
154
154
 
155
155
  Lançamento: *20/02/2024*
156
156
 
@@ -109,11 +109,11 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
109
109
  - **waiter** - Funções para aguardar em relação a execução de uma função, podendo ser antes ou depois
110
110
  - **exec_at** - Funções para executar em momentos pré determinados
111
111
  - **date**
112
- - **date** - Funções para capturar data, mes, ano, hora, minutos de forma individual em apenas uma linha
112
+ - **date** - Funções para capturar data, mês, ano, hora, minutos de forma individual em apenas uma linha
113
113
  - **email**
114
114
  - **sender_smtp** - Funções para envio de email SMPT
115
115
  - **file**
116
- - **counter** - Funções para contagens
116
+ - **counter** - Funções para contagem de arquivos
117
117
  - **temp_dir** - Funções para diretórios temporários
118
118
  - **log**
119
119
  - **loggin** - Funções decoradoras com log de execução das funções
@@ -125,7 +125,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
125
125
  - **string_validator** - Funções para validação/varredura (strings, substrings, palavras)
126
126
 
127
127
  ## Release
128
- Versão: **Alpha 0.9.1**
128
+ Versão: **Alpha 0.9.3**
129
129
 
130
130
  Lançamento: *20/02/2024*
131
131
 
@@ -0,0 +1,36 @@
1
+ import schedule
2
+ import time
3
+ import subprocess
4
+
5
+ def run_python_script(script_path):
6
+ try:
7
+ subprocess.run(['python', script_path], check=True)
8
+ except subprocess.CalledProcessError as e:
9
+ print(f"Erro ao executar o script {script_path}: {e}")
10
+
11
+ def batch1():
12
+ # Substitua 'script1.py' pelo caminho do primeiro script Python que deseja executar
13
+ run_python_script('script1.py')
14
+
15
+ def batch2():
16
+ # Substitua 'script2.py' pelo caminho do segundo script Python que deseja executar
17
+ run_python_script('script2.py')
18
+
19
+ def batch3():
20
+ # Substitua 'script3.py' pelo caminho do terceiro script Python que deseja executar
21
+ run_python_script('script3.py')
22
+
23
+ print("Aguardando nova execução...")
24
+
25
+ # Horário para executar o primeiro batch (substitua com o horário desejado)
26
+ schedule.every().day.at("08:00").do(batch1)
27
+
28
+ # Horário para executar o segundo batch (substitua com o horário desejado)
29
+ schedule.every().day.at("12:00").do(batch2)
30
+
31
+ # Horário para executar o terceiro batch (substitua com o horário desejado)
32
+ schedule.every().day.at("16:00").do(batch3)
33
+
34
+ while True:
35
+ schedule.run_pending()
36
+ time.sleep(1)
@@ -0,0 +1,171 @@
1
+ import os, shutil
2
+ from typing import Union
3
+ from rpa_suite.log.printer import error_print, alert_print, success_print
4
+
5
+
6
+ def create_temp_dir(path_to_create: str = 'default', name_temp_dir: str='temp') -> dict[str, Union[bool, str, None]]:
7
+
8
+ """
9
+ Function responsible for creating a temporary directory to work with files and etc. \n
10
+
11
+ Parameters:
12
+ ----------
13
+ ``path_to_create: str`` - should be a string with the full path pointing to the folder where the temporary folder should be created, if it is empty the ``default`` value will be used which will create a folder in the current directory where the file containing this function was called.
14
+
15
+ ``name_temp_dir: str`` - should be a string representing the name of the temporary directory to be created. If it is empty, the ``temp`` value will be used as the default directory name.
16
+
17
+ Return:
18
+ ----------
19
+ >>> type:dict
20
+ * 'success': bool - represents case the action was performed successfully
21
+ * 'path_created': str - path of the directory that was created on the process
22
+
23
+ Description: pt-br
24
+ ----------
25
+ Função responsavel por criar diretório temporário para trabalhar com arquivos e etc. \n
26
+
27
+ Parametros:
28
+ ----------
29
+ ``path_to_create: str`` - deve ser uma string com o path completo apontando para a pasta onde deve ser criada a pasta temporaria, se estiver vazio sera usado valor ``default`` que criará pasta no diretório atual onde o arquivo contendo esta função foi chamada.
30
+
31
+ ``name_temp_dir: str`` - deve ser uma string representando o nome do diretório temporário a ser criado. Se estiver vazio, o valor ``temp`` será usado como o nome padrão do diretório.
32
+
33
+ Retorno:
34
+ ----------
35
+ >>> type:dict
36
+ * 'success': bool - representa se ação foi realizada com sucesso
37
+ * 'path_created': str - path do diretório que foi criado no processo
38
+ """
39
+
40
+ # Local Variables
41
+ result: dict = {
42
+ 'success': bool,
43
+ 'path_created': str,
44
+ }
45
+
46
+ try:
47
+ # by 'default', defines path to local script execution path
48
+ if path_to_create == 'default':
49
+ path_to_create: str = os.getcwd()
50
+
51
+ # Build path to new dir
52
+ full_path: str = os.path.join(path_to_create, name_temp_dir)
53
+
54
+ # Create dir in this block
55
+ try:
56
+
57
+ # Successefully created
58
+ os.makedirs(full_path, exist_ok=False)
59
+
60
+ result['success'] = True
61
+ result['path_created'] = fr'{full_path}'
62
+
63
+ success_print(f"Diretório:'{full_path}' foi criado com sucesso.")
64
+
65
+ except FileExistsError:
66
+ result['success'] = False
67
+ result['path_created'] = None
68
+ alert_print(f"Diretório:'{full_path}' já existe.")
69
+
70
+ except PermissionError:
71
+ result['success'] = False
72
+ result['path_created'] = None
73
+ alert_print(f"Permissão negada: não é possível criar o diretório '{full_path}'.")
74
+
75
+ except Exception as e:
76
+ result['success'] = False
77
+ result['path_created'] = None
78
+ error_print(f'Error capturing current path to create temporary directory! Error: {str(e)}')
79
+
80
+ finally:
81
+ return result
82
+
83
+
84
+ def delete_temp_dir(path_to_delete: str = 'default', name_temp_dir: str='temp', delete_files: bool = False) -> dict[str, Union[bool, str, None]]:
85
+
86
+ """
87
+ Function responsible for deleting a temporary directory. \n
88
+
89
+ Parameters:
90
+ ----------
91
+ ``path_to_delete: str`` - should be a string with the full path pointing to the folder where the temporary folder should be deleted, if it is empty the ``default`` value will be used which will delete a folder in the current directory where the file containing this function was called.
92
+
93
+ ``name_temp_dir: str`` - should be a string representing the name of the temporary directory to be deleted. If it is empty, the ``temp`` value will be used as the default directory name.
94
+
95
+ ``delete_files: bool`` - should be a boolean indicating whether to delete files in the directory. If it is False, files in the directory will not be deleted.
96
+
97
+ Return:
98
+ ----------
99
+ >>> type:dict
100
+ * 'success': bool - represents case the action was performed successfully
101
+ * 'path_deleted': str - path of the directory that was deleted on the process
102
+
103
+ Description: pt-br
104
+ ----------
105
+ Função responsavel por deletar diretório temporário. \n
106
+
107
+ Parametros:
108
+ ----------
109
+ ``path_to_delete: str`` - deve ser uma string com o path completo apontando para a pasta onde deve ser deletada a pasta temporaria, se estiver vazio sera usado valor ``default`` que deletará pasta no diretório atual onde o arquivo contendo esta função foi chamada.
110
+
111
+ ``name_temp_dir: str`` - deve ser uma string representando o nome do diretório temporário a ser deletado. Se estiver vazio, o valor ``temp`` será usado como o nome padrão do diretório.
112
+
113
+ ``delete_files: bool`` - deve ser um booleano indicando se deve deletar arquivos no diretório. Se for False, arquivos no diretório não serão deletados.
114
+
115
+ Retorno:
116
+ ----------
117
+ >>> type:dict
118
+ * 'success': bool - representa se ação foi realizada com sucesso
119
+ * 'path_deleted': str - path do diretório que foi deletado no processo
120
+ """
121
+
122
+ # Local Variables
123
+ result: dict = {
124
+ 'success': bool,
125
+ 'path_deleted': str,
126
+ }
127
+
128
+ try:
129
+ # by 'default', defines path to local script execution path
130
+ if path_to_delete == 'default':
131
+ path_to_delete: str = os.getcwd()
132
+
133
+ # Build path to new dir
134
+ full_path: str = os.path.join(path_to_delete, name_temp_dir)
135
+
136
+ # Delete dir in this block
137
+ try:
138
+
139
+ # Check if directory exists
140
+ if os.path.exists(full_path):
141
+
142
+ # Check if delete_files is True
143
+ if delete_files:
144
+ # Delete all files in the directory
145
+ shutil.rmtree(full_path)
146
+
147
+ else:
148
+ # Delete the directory only
149
+ os.rmdir(full_path)
150
+
151
+ result['success'] = True
152
+ result['path_deleted'] = fr'{full_path}'
153
+
154
+ success_print(f"Diretório:'{full_path}' foi deletado com sucesso.")
155
+ else:
156
+ result['success'] = False
157
+ result['path_deleted'] = None
158
+ alert_print(f"Diretório:'{full_path}' não existe.")
159
+
160
+ except PermissionError:
161
+ result['success'] = False
162
+ result['path_deleted'] = None
163
+ alert_print(f"Permissão negada: não é possível deletar o diretório '{full_path}'.")
164
+
165
+ except Exception as e:
166
+ result['success'] = False
167
+ result['path_deleted'] = None
168
+ error_print(f'Error capturing current path to delete temporary directory! Error: {str(e)}')
169
+
170
+ finally:
171
+ return result
@@ -10,10 +10,10 @@ from .email.sender_smtp import send_email
10
10
 
11
11
  """MODULE FILE"""
12
12
  from .file.counter import count_files
13
- from .file.temp_dir import create_temp_dir, clear_temp_dir
13
+ from .file.temp_dir import create_temp_dir, delete_temp_dir
14
14
 
15
15
  """MODULE LOG"""
16
- from .log.loggin import logging_decorator
16
+ # from .log.loggin import logging_decorator
17
17
  from .log.printer import alert_print, success_print, error_print, info_print, print_call_fn, print_retur_fn, magenta_print, blue_print
18
18
 
19
19
  """MODULE REGEX"""
@@ -63,7 +63,8 @@ class Rpa_suite():
63
63
  # file
64
64
  count_files = count_files
65
65
  create_temp_dir = create_temp_dir
66
- clear_temp_dir = clear_temp_dir
66
+ delete_temp_dir = delete_temp_dir
67
+ #clear_temp_dir = clear_temp_dir
67
68
 
68
69
  # log
69
70
  alert_print = alert_print
@@ -89,3 +90,4 @@ class Rpa_suite():
89
90
  def invoke():
90
91
  suite = Rpa_suite()
91
92
  return suite
93
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rpa-suite
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.
5
5
  Author: Camilo Costa de Carvalho
6
6
  Author-email: camilo.carvalho@triasoftware.com.br
@@ -134,11 +134,11 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
134
134
  - **waiter** - Funções para aguardar em relação a execução de uma função, podendo ser antes ou depois
135
135
  - **exec_at** - Funções para executar em momentos pré determinados
136
136
  - **date**
137
- - **date** - Funções para capturar data, mes, ano, hora, minutos de forma individual em apenas uma linha
137
+ - **date** - Funções para capturar data, mês, ano, hora, minutos de forma individual em apenas uma linha
138
138
  - **email**
139
139
  - **sender_smtp** - Funções para envio de email SMPT
140
140
  - **file**
141
- - **counter** - Funções para contagens
141
+ - **counter** - Funções para contagem de arquivos
142
142
  - **temp_dir** - Funções para diretórios temporários
143
143
  - **log**
144
144
  - **loggin** - Funções decoradoras com log de execução das funções
@@ -150,7 +150,7 @@ O módulo principal do rpa-suite é dividido em categorias. Cada categoria cont
150
150
  - **string_validator** - Funções para validação/varredura (strings, substrings, palavras)
151
151
 
152
152
  ## Release
153
- Versão: **Alpha 0.9.1**
153
+ Versão: **Alpha 0.9.3**
154
154
 
155
155
  Lançamento: *20/02/2024*
156
156
 
@@ -10,6 +10,7 @@ rpa_suite.egg-info/requires.txt
10
10
  rpa_suite.egg-info/top_level.txt
11
11
  rpa_suite/clock/__init__.py
12
12
  rpa_suite/clock/exec_at.py
13
+ rpa_suite/clock/scheduler.py
13
14
  rpa_suite/clock/waiter.py
14
15
  rpa_suite/date/__init__.py
15
16
  rpa_suite/date/date.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='rpa_suite',
5
- version='0.9.1',
5
+ version='0.9.3',
6
6
  packages=find_packages(),
7
7
  description='Conjunto de ferramentas essenciais para Automação RPA com Python, que facilitam o dia a dia de desenvolvimento.',
8
8
  long_description_content_type='text/markdown',
@@ -1,161 +0,0 @@
1
- import os, shutil
2
- from rpa_suite.log.printer import error_print, alert_print, success_print
3
-
4
- def create_temp_dir(path_to_create: str = 'default') -> dict:
5
-
6
- """
7
- Function responsible for creating a temporary directory to work with files and etc. \n
8
-
9
- Parameters:
10
- ----------
11
- ``path_to_create: str`` - should be a string with the full path pointing to the folder where the temporary folder should be created, if it is empty the ``default`` value will be used which will create a folder in the current directory where the file containing this function was called.
12
-
13
- Return:
14
- ----------
15
- >>> type:dict
16
- * 'success': bool - represents if the action was performed successfully
17
- * 'path_created': str - path of the directory that was created in the process
18
-
19
- Description: pt-br
20
- ----------
21
- Função responsavel por criar diretório temporário para trabalhar com arquivos e etc. \n
22
-
23
- Parametros:
24
- ----------
25
- ``path_to_create: str`` - deve ser uma string com o path completo apontando para a pasta onde deve ser criada a pasta temporaria, se estiver vazio sera usado valor ``default`` que criará pasta no diretório atual onde o arquivo contendo esta função foi chamada.
26
-
27
- Retorno:
28
- ----------
29
- >>> type:dict
30
- * 'success': bool - representa se ação foi realizada com sucesso
31
- * 'path_created': str - path do diretório que foi criado no processo
32
- """
33
-
34
- # Local Variables
35
- result: dict = {
36
- 'success': bool,
37
- 'path_created': str
38
- }
39
-
40
- # Preprocessing
41
- default_dir: str
42
- try:
43
- if path_to_create == 'default':
44
- default_dir = os.path.dirname(os.path.abspath(__file__))
45
- else:
46
- default_dir = fr'{path_to_create}'
47
- except Exception as e:
48
- result['success'] = False
49
- error_print(f'Error capturing current path to create temporary directory! Error: {str(e)}')
50
-
51
- # Process
52
- try:
53
- if not os.path.exists(fr'{default_dir}\temp'):
54
- try:
55
- os.mkdir(fr'{default_dir}\temp')
56
- if os.path.exists(fr'{default_dir}\temp'):
57
- result['success'] = True
58
- success_print(fr'Directory created in: {default_dir}\temp')
59
- else:
60
- result['success'] = False
61
- raise Exception
62
- except Exception as e:
63
- error_print(f'Unable to create temporary directory! Error: {str(e)}')
64
- else:
65
- result['success'] = True
66
- alert_print(fr'NOTICE! directory already exists in: {default_dir}\temp ')
67
- except Exception as e:
68
- error_print(f'Error when trying to create temporary directory in: {default_dir} - Error: {str(e)}')
69
-
70
- # Postprocessing
71
- result['path_created'] = fr'{default_dir}\temp'
72
-
73
- return result
74
-
75
-
76
- def clear_temp_dir(path_to_clear: str = 'default', name_dir: str = '') -> dict:
77
-
78
- """
79
- Function responsible for cleaning the temporary directory at the specified path. \n
80
-
81
- Parameters:
82
- ----------
83
- ``path_to_cleaned: str`` - a string that points to the destination to be cleaned, which can be: \n
84
- - relative path - based on the file where this function is being called
85
- - absolute path - based on the local disk of the machine or server
86
-
87
- If not declared or if the argument is left empty, then the ``default`` value will be used, which will search for the folder in the current directory where the file containing this function was called.
88
-
89
- Return:
90
- ----------
91
- >>> type:dict
92
- * 'success': bool - represents if the action was performed successfully
93
- * 'path_cleaned': str - path of the directory that was cleaned in the process
94
-
95
- Description: pt-br
96
- ----------
97
- Função responsavel por limpar o diretório temporário no caminho especificado. \n
98
-
99
- Parametros:
100
- ----------
101
- ``path_to_cleaned: str`` - uma string que aponta para o destino a limpar podendo ser: \n
102
- - caminho relativo - com base no arquivo onde esta sendo chamada a função
103
- - caminho absoluto - com base no disco local da maquina ou servidor
104
-
105
- não declarar ou deixar o argumento vazio então será usado valor ``default`` que buscará a pasta no diretório atual onde o arquivo contendo esta função foi chamada.
106
-
107
- Retorno:
108
- ----------
109
- >>> type:dict
110
- * 'success': bool - representa se ação foi realizada com sucesso
111
- * 'path_cleaned': str - path do diretório que foi executada limpeza no processo
112
- """
113
-
114
- # Local Variables
115
- temp_dir_result: dict = {
116
- 'success': bool,
117
- 'path_cleaned': str
118
- }
119
-
120
- # Preprocessing
121
- default_dir: str
122
- personal_name_dir_clear: str = 'temp' if name_dir == '' else name_dir
123
-
124
- # Process
125
- try:
126
- if path_to_clear == 'default':
127
- default_dir = os.path.dirname(os.path.abspath(__file__))
128
- else:
129
- default_dir = fr'{path_to_clear}'
130
- except Exception as e:
131
- temp_dir_result['success'] = False
132
- error_print(f'Unable to capture current path to clear temporary folder! Error: {str(e)}')
133
-
134
- try:
135
- if os.path.exists(fr'{default_dir}/{personal_name_dir_clear}'):
136
- for root, dirs, files in os.walk(fr'{default_dir}\{personal_name_dir_clear}', topdown=False):
137
- for name in files:
138
- try:
139
- os.remove(os.path.join(root, name))
140
- except:
141
- pass
142
- for name in dirs:
143
- try:
144
- os.rmdir(os.path.join(root, name))
145
- except:
146
- pass
147
- temp_dir_result['success'] = True
148
- success_print(fr'Directory cleaned: "{default_dir}\{personal_name_dir_clear}"')
149
- else:
150
- temp_dir_result['success'] = False
151
- temp_dir_result['path_cleaned'] = None
152
- alert_print(fr'Directory does not exist: "{default_dir}\{personal_name_dir_clear}"')
153
-
154
- except Exception as e:
155
- error_print(fr'Error when trying to clear temporary directory: "{default_dir}\{personal_name_dir_clear}" - Error: {str(e)}')
156
-
157
- # Postprocessing
158
- if temp_dir_result['success']:
159
- temp_dir_result['path_cleaned'] = fr'{default_dir}\{personal_name_dir_clear}'
160
-
161
- return temp_dir_result
File without changes
File without changes