In the second example you are not actually creating a texture object. You are just passing the string containing the filename to the texture command. Unfortunately, the texture command silently ignores this error. It will be modified in a future release to raise an exception in this case. Either way, you can fix this problem by modifying the line:
Code:
self.obj.infoImage = contentsImage
to:
Code:
self.obj.infoImage = viz.add(contentsImage)