IBMDO YOU?Hi, I'm MBO!

Settings

Make the site feel at home on your screen.

Theme

Loading your theme preference.

Keyboard shortcuts

Open search from anywhere, then move through the results without leaving the keyboard.

Open settings
Ctrl,or⌘,
Open search
CtrlKor⌘K
Select a search result
↑↓
Open the selected result
Enter
Close an open dialog
Esc

I Build Maximo

Remove VS Code warnings in Maximo automation scripts

Remove Pylance import and undefined-variable warnings and cSpell spelling warnings from Maximo Jython scripts, with targeted fixes and a complete settings.json example.

The yellow squiggles

Open a Maximo Jython automation script in VS Code and the imports can immediately attract yellow wavy underlines:

VS Code showing yellow wavy underlines beneath psdi.mbo, psdi.server and psdi.util.logging in three Maximo imports.

from psdi.mbo import SqlFormat
from psdi.server import MXServer
from psdi.util.logging import MXLoggerFactory

If hovering over an underline shows Pylance and reportMissingImports, you can remove those warnings for your Maximo workspace with this setting in .vscode/settings.json:

{
  "python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none"
  }
}

Keep the imports in the script. It is the editor warning you are switching off.

This guide covers three common messages: unresolved Java imports, unknown spellings such as psdi, and implicit variables such as mbo that appear undefined. Each comes from a separate check. Start with the message in the hover tooltip, then apply the matching setting. A complete example combining the settings is at the end.

Why VS Code complains

Maximo runs Jython automation scripts inside its Java application environment. The psdi imports refer to Maximo Java classes available to that runtime.

Pylance analyses the file using its local view of Python source and type stubs. A normal local Python environment does not provide those Maximo classes, so an unresolved-import diagnostic is understandable even when the import is valid inside Maximo.

That also means the underline alone cannot tell you whether the script will run successfully. A misspelled class or a class unavailable in your Maximo release can still be a real problem.

Change the workspace settings

  1. Open the folder containing your automation scripts in VS Code.
  2. Hover over one of the underlined imports, or open the Problems panel. Confirm that the diagnostic is reportMissingImports from Pylance, as shown in the tooltip below.
  3. Open the Command Palette with Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on macOS.
  4. Run Preferences: Open Workspace Settings (JSON).
  5. Add the setting shown above and save the file.

If .vscode/settings.json already contains settings, merge python.analysis.diagnosticSeverityOverrides into the existing object. If that property already exists, add reportMissingImports inside it rather than creating a duplicate property. Preserve the other settings.

Workspace settings keep the change with this scripts project. Putting it in User settings would affect your other Python work too. In a multi-root workspace, check that you are editing the settings that apply to the folder containing the script.

The change suppresses all missing-import diagnostics in that scope, including genuine missing Python modules and misspelled imports. Use it in a workspace where that trade-off makes sense.

Two warnings on the same import

One import can attract warnings from more than one extension:

VS Code hover showing both the cSpell warning "psdi": Unknown word and the Pylance warning Import "psdi.mbo" could not be resolved, with diagnostic reportMissingImports.

The tooltip shows two separate checks:

  • Pylance / reportMissingImports: the analyser cannot resolve psdi.mbo. Use the import diagnostic override above.
  • cSpell / Unknown word: the spell checker does not recognise psdi. Pylance settings do not affect this warning.

To accept the spelling for this project, merge this entry into .vscode/settings.json, alongside your existing settings:

{
  "cSpell.words": ["psdi"]
}

If cSpell.words already exists, append psdi to its array. You can also use the spelling warning's Quick Fix to add the word to the workspace dictionary. This accepts the word without disabling spelling checks for the rest of the project.

If the project already manages its dictionary in cspell.json, add psdi to that file's words array instead. CSpell configuration files can override the corresponding VS Code settings.

Accepting the spelling does not resolve the import, and hiding the import diagnostic does not teach the spell checker the word. Apply the change for each warning you actually see.

Fix the "mbo is not defined" warning

Imports are only half the story. Pylance can also underline variables that Maximo supplies when it executes a script:

VS Code tooltip showing "mbo" is not defined, with Pylance diagnostic reportUndefinedVariable, above a condition using mbo.isToBeDeleted().

Here the diagnostic is reportUndefinedVariable. Suppressing reportMissingImports will not remove it because it is a different rule.

Maximo makes implicit variables available according to the script's execution context. For example, an attribute launch point provides mbo for the business object associated with the event. Pylance cannot infer those injected bindings from an ordinary Python file. Check the launch point and available bindings before treating the warning as editor noise: a variable supplied in one context might be unavailable in another.

Option 1: Suppress the warning for the workspace

For a dedicated Maximo scripts workspace, add reportUndefinedVariable to the same overrides object. This example covers both the imports and implicit-variable warnings:

{
  "python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none",
    "reportUndefinedVariable": "none"
  }
}

Save .vscode/settings.json. If you also need the reportMissingModuleSource override described below, keep that entry alongside these two.

This suppresses every undefined-variable diagnostic in that scope, including typing mistakes in your own variable names. If you want those checks elsewhere, use one of the narrower options below.

If the workspace setting has no effect, check the project configuration overrides described below.

Option 2: Suppress it for one script

Add this comment near the top of the affected script:

# pyright: reportUndefinedVariable=false

Pylance honours Pyright diagnostic comments. This limits the override to this file, where it hides all undefined-variable warnings. The comment is valid in Jython and does not change runtime behaviour.

Option 3: Suppress it on individual lines

For a small number of references, use a diagnostic-specific comment on each affected line:

if mbo is not None and not mbo.isToBeDeleted():  # pyright: ignore[reportUndefinedVariable]
    description = mbo.getString("DESCRIPTION")  # pyright: ignore[reportUndefinedVariable]

The example assumes a launch point that supplies mbo. Each comment suppresses that rule on its own line, so other undefined names elsewhere in the script can still be reported. It also suppresses the same rule for any other name on that line.

Keep Maximo's binding intact

Do not add mbo = None just to make the editor happy. In a script where Maximo supplies mbo, that assignment would replace the runtime object. Likewise, if mbo is not None checks the value of an existing binding; it does not make an undefined name available.

If the script actually fails in Maximo with an undefined-name error, inspect its launch point, invocation and bindings. Editor suppression cannot supply a missing runtime variable.

Other import warnings and configuration overrides

Check the diagnostic name again before changing more settings. A different extension or rule needs its own configuration.

If Pylance reports reportMissingModuleSource instead, that is a separate diagnostic. Only if you actually see that rule, add its override alongside the first:

{
  "python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none",
    "reportMissingModuleSource": "none"
  }
}

If the VS Code settings have no effect, check for a pyrightconfig.json file or a [tool.pyright] section in pyproject.toml. Pylance project configuration can take precedence over the VS Code diagnostic overrides. If the project uses pyrightconfig.json, merge the rules you need at its top level. For example, to suppress both missing imports and undefined variables:

{
  "reportMissingImports": "none",
  "reportUndefinedVariable": "none"
}

For an existing [tool.pyright] section, the equivalent entry is:

[tool.pyright]
reportMissingImports = "none"
reportUndefinedVariable = "none"

Edit the configuration the project already uses; avoid adding competing configuration files just to silence an underline. If necessary, run Developer: Reload Window after saving.

What this changes

These settings control editor diagnostics. They do not install Maximo libraries, provide Java API completion, validate an import against your Maximo release or change how the script executes on the server.

For richer analysis, suitable Python type stubs can describe the Java APIs to the editor. Adding a Maximo JAR to Python's search paths does not turn it into Python source or a type stub.

To restore the warnings, remove the override from the configuration where you added it. Continue checking and testing the script in the Maximo environment where it will run. A quieter editor is useful; it is not a runtime test.

A complete settings.json example

This complete .vscode/settings.json combines the warning fixes with JSON schema mappings for Maximo development tooling. The schema mappings support validation of deployment configuration files; the Pylance and cSpell settings handle the script warnings.

The highlighted lines (20–25) are the added Pylance and cSpell settings. The schema list also needs a comma after its closing ] to separate it from the new settings.

{
  "json.schemas": [
    {
      "fileMatch": ["*.predeploy.json", "*-predeploy.json"],
      "url": "./.vscode/predeploy-schema.json"
    },
    {
      "fileMatch": [],
      "url": "./.vscode/deploy-schema.json"
    },
    {
      "fileMatch": ["*.manifest.json", "*-manifest.json"],
      "url": "./.vscode/manifest-schema.json"
    },
    {
      "fileMatch": [".devtools-config.json"],
      "url": "./.vscode/devtools-config-schema.json"
    }
  ],
  "python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none",
    "reportMissingModuleSource": "none",
    "reportUndefinedVariable": "none"
  },
  "cSpell.words": ["psdi"]
}

The schema files must exist at the referenced locations for those mappings to work. The deployment schema's empty fileMatch array is preserved; it does not automatically match any filenames.

This example includes all three Pylance overrides for convenience. Remove any override you do not need, particularly reportMissingModuleSource if that diagnostic is absent. Keep the narrower file or line options above in mind if you want undefined-variable checks elsewhere in the workspace.

For an empty settings file, paste the complete object. If you do not use the deployment schema files, omit the json.schemas property and keep the other two properties inside the outer braces. For a file with existing settings, merge these properties into its outer object, preserving any other entries.

References

Find the fix

Search articles

Esc

Search titles, technical terms or error codes.