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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
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
Hide 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
...
@@ -4,6 +4,7 @@ from Products.PortalTransforms.data import datastream
from
Products.PortalTransforms.libtransforms.commandtransform
\
from
Products.PortalTransforms.libtransforms.commandtransform
\
import
commandtransform
import
commandtransform
import
os
import
os
import
subprocess
import
tempfile
import
tempfile
from
zope.interface
import
implements
from
zope.interface
import
implements
...
@@ -30,11 +31,21 @@ class tiff_to_text(commandtransform):
...
@@ -30,11 +31,21 @@ class tiff_to_text(commandtransform):
text
=
None
text
=
None
try
:
try
:
command
=
self
.
binary
output_file_path
=
os
.
path
.
join
(
tmp_dir
,
'output'
)
output_file_path
=
os
.
path
.
join
(
tmp_dir
,
'output'
)
cmd
=
'%s %s %s'
%
(
cmd
=
self
.
binary
,
input_file
,
output_file_path
self
.
binary
,
input_file
,
output_file_path
)
process
=
subprocess
.
Popen
(
cmd
,
os
.
system
(
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'
)
output_file
=
open
(
output_file_path
+
'.txt'
,
'r'
)
out
=
output_file
.
read
()
out
=
output_file
.
read
()
output_file
.
close
()
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