Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
137
Merge Requests
137
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
966a81a3
Commit
966a81a3
authored
May 11, 2012
by
Leonardo Rochael Almeida
Committed by
Julien Muchembled
Oct 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report more information when tesseract fails
parent
01e71ab1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
product/PortalTransforms/transforms/tiff_to_text.py
product/PortalTransforms/transforms/tiff_to_text.py
+15
-4
No files found.
product/PortalTransforms/transforms/tiff_to_text.py
View file @
966a81a3
...
...
@@ -4,6 +4,7 @@ from Products.PortalTransforms.data import datastream
from
Products.PortalTransforms.libtransforms.commandtransform
\
import
commandtransform
import
os
import
subprocess
import
tempfile
from
zope.interface
import
implements
...
...
@@ -30,11 +31,21 @@ class tiff_to_text(commandtransform):
text
=
None
try
:
command
=
self
.
binary
output_file_path
=
os
.
path
.
join
(
tmp_dir
,
'output'
)
cmd
=
'%s %s %s'
%
(
self
.
binary
,
input_file
,
output_file_path
)
os
.
system
(
cmd
)
cmd
=
self
.
binary
,
input_file
,
output_file_path
process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,)
stdout
=
process
.
communicate
()[
0
]
err
=
process
.
returncode
if
err
:
if
err
<
0
:
exit_msg
=
'killed with signal %s'
%
-
err
else
:
exit_msg
=
'exited with status %s'
%
err
raise
EnvironmentError
(
'Command %r %s. Command output:
\
n
%s'
%
(
cmd
,
exit_msg
,
stdout
))
output_file
=
open
(
output_file_path
+
'.txt'
,
'r'
)
out
=
output_file
.
read
()
output_file
.
close
()
...
...
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