Congratulations you got it to work! But I should have told you something which answers:
Ok, here is another solution. As you can see, I also put the pil method in the class. It seems to work, but I may have missed some imortant point. Can you confirm this is correct? I prefer this solution, with only objects…
By design every action should have its pil code independent of the action. This is basically to keep things loosely coupled and that someone can import your action like:
without touching anything Phatch specific. In your code there is no distinction between the Phatch code and the PIL code. I want to keep them seperate. The whole Phatch is designed around the idea that the PIL code should be able to be used independently of Phatch. So please revert back the architecture of the action to my proposal.
Another remark is: never use print statements. Python 3.0 is around the corner and print statements will break the code. In the whole Phatch not one print statement is used. (I sometimes put one temporarily for debugging but I always remove it.)
Phatch gives you nice tools for messaging. You can easily display dialog boxes (or when phatch runs in console mode they will be printed to stdout):
from message import send
If you only want to write to the log file do:
from core.api import ERROR_LOG_FILE
Can you please refactor your code so it follows the separation between PIL and Phatch?
Thanks you so much! Your contribution was the first. Also I would like you to document the process on the wiki, so future contributions will be easier for everyone.