Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zhougaofeng
magic_pdf
Commits
391402b1
Commit
391402b1
authored
Nov 13, 2024
by
zhougaofeng
Browse files
Update common_parse.py
parent
13af2481
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
magic_pdf/parse/common_parse.py
magic_pdf/parse/common_parse.py
+2
-2
No files found.
magic_pdf/parse/common_parse.py
View file @
391402b1
...
@@ -43,7 +43,7 @@ def process_file(file_path, output_dir):
...
@@ -43,7 +43,7 @@ def process_file(file_path, output_dir):
start
=
time
.
time
()
start
=
time
.
time
()
if
file_path
.
endswith
(
'.pdf'
):
if
file_path
.
endswith
(
'.pdf'
):
res
=
pdf_ocr
.
ocr_pdf_client
(
path
=
file_path
,
output_dir
=
output_dir
)
res
=
pdf_ocr
.
ocr_pdf_client
(
config_
path
,
file_path
,
output_dir
)
elif
file_path
.
endswith
(
'.xls'
)
or
file_path
.
endswith
(
'.xlsx'
):
elif
file_path
.
endswith
(
'.xls'
)
or
file_path
.
endswith
(
'.xlsx'
):
res
=
excel_ocr
.
parse
(
file_path
,
output_dir
)
res
=
excel_ocr
.
parse
(
file_path
,
output_dir
)
elif
file_path
.
endswith
(
'.ofd'
):
elif
file_path
.
endswith
(
'.ofd'
):
...
@@ -58,7 +58,7 @@ def process_file(file_path, output_dir):
...
@@ -58,7 +58,7 @@ def process_file(file_path, output_dir):
except
requests
.
exceptions
.
RequestException
as
req_err
:
except
requests
.
exceptions
.
RequestException
as
req_err
:
logger
.
error
(
f
"请求错误,文件: '
{
file_path
}
',错误信息:
{
req_err
}
"
)
logger
.
error
(
f
"请求错误,文件: '
{
file_path
}
',错误信息:
{
req_err
}
"
)
except
Exception
as
err
:
except
Exception
as
err
:
logger
.
error
(
f
"处理文件时发生未知错误: '
{
file_path
}
',错误信息:
{
err
}
,res:
{
res
}
"
)
logger
.
error
(
f
"处理文件时发生未知错误: '
{
file_path
}
',错误信息:
{
err
}
"
)
def
normalize_path
(
input_path
):
def
normalize_path
(
input_path
):
"""Normalize file paths to use forward slashes."""
"""Normalize file paths to use forward slashes."""
...
...
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