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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
81d0116b
Commit
81d0116b
authored
Dec 16, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subprocess.Popen objects are not supported as context managers on Python < 3.2
parent
d62dacd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
product/PortalTransforms/libtransforms/imagemagick_transform.py
...t/PortalTransforms/libtransforms/imagemagick_transform.py
+8
-5
No files found.
product/PortalTransforms/libtransforms/imagemagick_transform.py
View file @
81d0116b
...
@@ -26,14 +26,17 @@ class ImageMagickTransforms:
...
@@ -26,14 +26,17 @@ class ImageMagickTransforms:
if
depth
:
if
depth
:
parameter_list
.
extend
([
'-depth'
,
'%s'
%
depth
,
'-type'
,
'Palette'
])
parameter_list
.
extend
([
'-depth'
,
'%s'
%
depth
,
'-type'
,
'Palette'
])
parameter_list
.
append
(
'%s:-'
%
self
.
format
)
parameter_list
.
append
(
'%s:-'
%
self
.
format
)
with
subprocess
.
Popen
(
parameter_list
,
p
=
subprocess
.
Popen
(
parameter_list
,
stdin
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
close_fds
=
True
)
as
p
:
close_fds
=
True
)
try
:
# XXX: The only portable way is to pass what stdin.write can accept,
# XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE.
# which is a string for PIPE.
image
,
err
=
p
.
communicate
(
str
(
orig
))
image
,
err
=
p
.
communicate
(
str
(
orig
))
finally
:
del
p
data
.
setData
(
image
)
data
.
setData
(
image
)
return
data
return
data
...
...
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