Implementation of "Command line action with themporary files or pipes"

Bug #386682 reported by Juho Vepsäläinen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
Invalid
Undecided
Stani
Tags: patch
Revision history for this message
Juho Vepsäläinen (bebraw) wrote :
Revision history for this message
Stani (stani) wrote :

Juho, did you actually try this one? It is full of errors :-(
- your regular expressions (eg '!input!') are not right, please look up the right ones. Please compile the regular expressions and make them available as class attribute.
- never use image.filename, normally you would pass info['path'] as an argument but in this case both input and output need to be temporary files. Save the current pil image (photo.get_layer().image) as a temporary file and pass its temporary name to the
re.sub('!input!', image.filename, command)
- Also don't use the deprecated os.system, but do:
from subprocess import call
call('command',shell=True)

Hmmm... maybe it is better I do this. By the time I have explained all the errors, I've done it myself. In case you don't know how to do something it is better to ask before submitting the patch.

Thanks a lot anyway for trying! Really!

Changed in phatch:
assignee: nobody → stani (stani)
status: New → Incomplete
Revision history for this message
Juho Vepsäläinen (bebraw) wrote :

Okay. I consider it still a work in progress (should have stated that). :)

I tested it with a simple case "convert !input! -resize '200%' !output!" it seemed to work fine. I admit that submitting concrete test cases with patches would be the right way to go. This way it would easier to see that my expectations of the way the code should work are right and there are less misunderstandings.

I fail to see the issue with regex. As far as I understand re.sub just does a simple replacement operation. Could you provide case in which it fails? I'm not a big fan of the !input/output! syntax. Perhaps there's a better way to sort it out? Originally I tried with <input/output> but it clashes with the current system. Good point about making the input a temporary file!

I will replace os.system. I just found subprocess call/check_call yesterday while working on lossless JPEG action.

Stani (stani)
Changed in phatch:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.