History directive "#" is ignored in "Python Script"

@Katsu, this seems to workaround the # problem using python.

c.