Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BAO
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
eigenlab
BAO
Commits
3164ba02
Commit
3164ba02
authored
Oct 01, 2017
by
biondo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a try/except to skip the file analysis if PyPdf crash when opening the file.
parent
287ce125
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
main.py
main.py
+8
-1
No files found.
main.py
View file @
3164ba02
...
...
@@ -20,6 +20,8 @@ parser.add_argument( '-p', '--pattern', nargs = 1,
args
=
parser
.
parse_args
()
#----------------------------#
type_stat
=
{}
total_files
=
0.0
metadata
=
{}
...
...
@@ -52,7 +54,12 @@ for path, subdirs, files in os.walk(args.directory[0]):
current_book
=
{}
current_book
[
'path'
]
=
os
.
path
.
join
(
path
,
name
)
f
=
open
(
os
.
path
.
join
(
path
,
name
),
"rb"
)
pdf_toread
=
PdfFileReader
(
f
)
try
:
pdf_toread
=
PdfFileReader
(
f
)
except
:
print
"[analyzing]
\t
PdfFileReader cannot open this file. Skipping analysis."
break
try
:
if
pdf_toread
.
isEncrypted
:
pdf_toread
.
decrypt
(
''
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment