Hello Fernando,
Please check the latest build (1.0.4). I've just tested the operation by myself and haven't encountered any problems.
chunk = PhotoScan.app.document.activeChunk
image = chunk.cameras[0].image() #first photo image
mask = PhotoScan.utils.createDifferenceMask(image, (200, 200, 200), tolerance = 50, fit_colors = True)
this code has worked for me.