Friday, June 12, 2020

Exception handling in Maximo automation scripts with try except

For the longest time, I thought that try/except blocks didn't work in automation scripts. A colleague asked me about them yesterday, so I figured I would try it out again, and found that they work. It's really just like normal Python exception handling. Here's a script I used to test it, with an Object Launch Point on Save for the SR object:

from psdi.server import MXServer
import sys

try:
  mbo.getMboValue("FOOBAR")
except:
  print "an error was encountered"
  e = sys.exc_info()[0]
  print(e)

The expected behavior is that a message will be written to the log file, but that an SR will be created, and that's exactly the behavior I observed. Here's what was in the log file:

[6/12/20 9:25:50:961 EDT] 000021c4 SystemOut     O 12 Jun 2020 09:25:50:961 [DEBUG] [MAXIMO] [] an error was encountered
<type 'psdi.util.MXApplicationException'>

Happy scripting!

Tuesday, June 9, 2020

Windows users, set up your Print Screen key to launch the Snip and Sketch tool

After years of using different mechanisms to take screenshots or partial screenshots, I've finally recognized that the absolute best way is to configure your Print Screen key to launch the Snip and Sketch tool. It's easy to do and will make your life much easier:

https://winaero.com/blog/print-screen-screen-snipping-windows-10/

Now that it's configured, just press your Print Screen key and you can then outline a rectangular area of your screen to copy. Once selected, the image is copied to your clipboard, but the Snip application isn't launched. If you need to launch the application, you can click on the notification that was generated when you selected the area (I normally just need to paste the image into a document, so I'm very happy that the application isn't launched). That's it. It's a very small change that has made my personal workflow much more efficient.

designer/missingid error when importing application definition in ICD 7.6.1 using port forwarding

Background

I encountered a strange error with my IBM Control Desk development environment and wanted to share because I couldn't find any hits on Google.

Problem

The problem I've encountered is the following error when trying to import any application XML into ICD 7.6.1.1:


And the import fails. It does this on all Windows and Linux browsers that I tried (Chrome, IE, Firefox, Edge, new Edge, Chromium, etc.), so it doesn't appear to be a browser problem.

Workaround

I realized that my ICD VM is running on my VMWare host on a NAT network, and I've got port forwarding configured to allow me to access it from systems on my home network. So I figured I would try the same steps using a browser either running on the ICD VM itself or on another VM on the same NAT network. And that works! So the issue is something to do with my configuration of port forwarding or something else in my network AFAIK. More importantly, it's NOT a problem with ICD.

I've used my browser's Developer Tools to analyze what's going on, and I don't see any difference between a failing browser and a working one, so I think there's something going on in ICD. However, I know that this particular configuration isn't one that I'm likely to see at any customer site, especially since I'm using VMWare Workstation to run my VMs. So I'm just documenting this here so there's at least one Google hit on the problem, along with at least one workaround.