There’s a multitude of IDEs (Integrated Development Environments) out there, all with their unique benefits. Two popular IDEs for Python are PyCharm and Visual Studio Code (VSC).

    I fall into the camp of liking VSC. As I’m more focused on FME development rather than pure coding, I dabble in a range of different languages and formats. A universal IDE like VSC is preferable to me over a language specific IDE like PyCharm.

    Now you may be asking, ‘Why use an external IDE when you can write Python in the PythonCaller or PythonCreator?’. Well, for basic Python I don’t tend to bother loading it up in VSC, I just write it straight into the PythonCaller. You get the benefit of being able to interact directly with features – something you don’t get in VSC – but you also don’t have the ability to put break points in and debugging becomes difficult.

    Improvements that could be made to Python editing inside of FME has received a bit of attention over the years – shout out to this Idea on the Safe Software FME Community

    There’s a reason I mentioned PyCharm at the beginning, and that’s because Safe has a guide on how to setup FME Python in this FME Support Center article.

    Of course, I don’t use PyCharm, and I want to have this functionality in VSC. So I took it upon myself to write the following steps on how you can get FME Python integrated into VSC.

    1.Startup VSC, open your working folder and then save your current Workspace, File > Save Workspace As…

    2. Next open up VSCs command palette  using crtl+shift+p and search for Open Workspace Settings

    3. A blank JSON file will be opened, in here we can instruct VSC to start referencing FMEs Python libraries. Using the install location of your FME Form instance, we need to specify five paths:

    1. “python.analysis.extraPaths”“
      • <FMEInstallDir>”
      • <FMEInstallDir>/python”
      • “<FMEInstallDir>/python/python312”
      • “<FMEInstallDir>/fmeobjects/python312”
    2. “python.defaultInterpreterPath”
      • “<FMEInstallDir>/fmepython312/python.exe”

    You will need to adjust these to suit the exact version of FME/Python you have on your system.

      We’ll also set “python.analysis.autoImportCompletions”: true

      This sets up the editor window and allows the editor to read what libraries there are available and will attempt to provide auto completion hints.

      4. Next, we need to setup the debugger. Press ctrl+shift+d to open the Debug view, then click on create a launch.json file. Much like the previous step, this will open a JSON file.

      In here we want to add a new object to the JSON called env and under that specify:

      a. “FME_HOME”
      i. “<FMEInstallDir>”

      b. “PYTHONPATH”
      i. “<FMEInstallDir>;“<FMEInstallDir>/python;<FMEInstallDir>/python/python312;<FMEInstallDir>/fmeobjects/python312”

            Note that PYTHONPATH  contains the four directories as in the previous step, instead with a semicolon separating them

            5. Now either open and close VSC, or open the command palette (ctrl+shift+p) and search for Developer: Reload Window Press enter and you should see the UI reload.

            With this all complete, you should now be able to import the FME libraries.

            One thing to note, to use the fmeobjects library, you first need to import fmebootstrap. The reason why is detailed towards the bottom of this Safe Software FME Support Center article.

            Happy FME Python-ing!

            FME and Python

            More Resources

            Contact Hamish Kingsbury

            Learn more about FME
            Register for FME Accelerator: free 90 min intro to FME