File Not Found? Missing Output? Quick Tips to Troubleshoot Python Errors

Minitab Blog Editor | 29 July, 2020

Topics: Machine Learning, Minitab Statistical Software, Python

Minitab’s Python connectivity feature allows users to run open-source Python scripts from within the Minitab interface and displays the results in Minitab’s output pane. Connectivity with Python means that custom analysis or graphs that are not already available in Minitab’s menus are only a few clicks away. And best of all, you don’t need to be a Python programmer to set this up.

Like with anything new, sometimes we can run into some issues, but don’t despair. In this post, I’ll give you a few quick tips for troubleshooting common errors, and we’ll get your script up and running in no time!

File Not Found

You’re set up and ready to run your analysis, and when you call your script from the Minitab command line (or by clicking a button in your toolbar), Minitab’s output pane shows an error:

python-error-file-not-found

First, be sure that both Python and the mtbpy module are installed on your computer per the documentation.

Oftentimes, the fix for this issue is to set the Default file location of your Python scripts, using this menu path in Minitab: File > Options, then click the "..." button to the right side of the first field to browse to the location where your Python script is saved:

python-error-check-file-location-default

Click OK to save the changes. Note that the default file location is also the default folder for saving and opening Minitab files; Minitab will use this location as the default going forward unless you change the option again in this window. After making the change, try running your script again and hopefully you’ll taste sweet success!

python-error-file-not-found-fixed-word-cloud

If you’re still seeing the same message, it is likely that Minitab can’t locate your Python installation. To resolve this, Python might need to be added to your system environment variables, which may require help from your IT team to make this change.

The Python Script Did Not Create Any Minitab Outputs

Let's say you call a script from Minitab and the output pane has another message that you were not expecting:

python-error-did-not-create-minitab-outputs

You could see this message for a couple of reasons. It’s possible the Python script you executed didn’t include the commands to send the results back to Minitab. Or, if the result of your script is an output file, such as a .CSV, you might need to open the file in Minitab manually. In either case, the solution is the same: Check the folder that you set as your Default file location within Minitab:

python-error-did-not-create-minitab-outputs-check-file-location

In the case above, I was expecting a CSV file as the result from my Python script. I found the file in my Minitab default file location and used my mouse to click and drag the file into Minitab.

Wrapping Up

Looking for more information on Minitab's new Python integration? Head to Minitab Support for more information. And, as always, if you have not tried the latest version of Minitab with Python integration, feel free to take the first 30 days on us!

New call-to-action