Library with common primitives for Python_ programming language
Revisión | 5c2967d71bb087f112206f6dfc3ebfcd259a9aa7 (tree) |
---|---|
Tiempo | 2022-01-03 22:47:38 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
PEP8 fixes, print exception information to the console
@@ -17,7 +17,8 @@ | ||
17 | 17 | def availableCpuCount(): |
18 | 18 | try: |
19 | 19 | cpuCount = multiprocessing.cpu_count() |
20 | - except: | |
20 | + except Exception as e: | |
21 | + print('Python exception:\"' + str(e) + '\"') | |
21 | 22 | cpuCount = 1 |
22 | 23 | |
23 | 24 | return cpuCount |
@@ -43,6 +43,8 @@ | ||
43 | 43 | |
44 | 44 | if doRaise: |
45 | 45 | raise |
46 | + except Exception as e: | |
47 | + print('Python exception:\"' + str(e) + '\"') | |
46 | 48 | |
47 | 49 | |
48 | 50 | def removeAllFilesInDir(dir, ignoreList = ['']): |
@@ -192,6 +194,8 @@ | ||
192 | 194 | |
193 | 195 | if not os.path.isdir(path): |
194 | 196 | raise |
197 | + except Exception as e: | |
198 | + print('Python exception:\"' + str(e) + '\"') | |
195 | 199 | |
196 | 200 | |
197 | 201 | def extractFilesFromTarArchive(archive, destDir): |
@@ -223,5 +227,5 @@ | ||
223 | 227 | shutil.copyfileobj(fIn, fOut) |
224 | 228 | |
225 | 229 | return destFile |
226 | - except OSError as e: | |
227 | - pass | |
230 | + except Exception as e: | |
231 | + print('Python exception:\"' + str(e) + '\"') |
@@ -8,7 +8,6 @@ | ||
8 | 8 | |
9 | 9 | from glob import glob |
10 | 10 | import os |
11 | -import shutil | |
12 | 11 | import sys |
13 | 12 | |
14 | 13 | sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) |
@@ -26,4 +25,5 @@ | ||
26 | 25 | fs.removeFile(os.path.join(pyRepoDir, 'pyrepo_README.pdf')) |
27 | 26 | fs.removeFile(os.path.join(pyRepoDir, 'pyrepo_README_RU.pdf')) |
28 | 27 | |
28 | + | |
29 | 29 | main() |
@@ -55,7 +55,8 @@ | ||
55 | 55 | [kTemplate()], |
56 | 56 | [kTemplate() + '\n' + kRevisionLocalizedStr() + ': ' + revision + '\n\n'] |
57 | 57 | ) |
58 | - except: | |
58 | + except Exception as e: | |
59 | + print('Python exception:\"' + str(e) + '\"') | |
59 | 60 | print('Couldn\'t find VCS info at the \'' + vcsDir + '\' directory and embed it to the output document') |
60 | 61 | fs.removeFile(rstFileCopy) |
61 | 62 | rstFileCopy = args.rst_file |