Thanks you it helped me.
I got problems with messages containing quotes so I wrote:
(if icon
(pymacs-exec (format "msg = pynotify.Notification(\"\"\"%s\"\"\",\"\"\"%s\"\"\",\"\"\"%s\"\"\")"
title
message
icon))
(pymacs-exec (format "msg = pynotify.Notification(\"\"\"%s\"\"\",\"\"\"%s\"\"\")" title message))
)
Very awful to read but it works and you can have quotes or double quotes in title/message/icon