Skip to main content
Question

How to fix PythonCaller error: Can't find a usable init.tcl

  • June 8, 2020
  • 0 replies
  • 563 views

When running the pythoncaller I got an error:

"Can't find a usable init.tcl in the following directories:"

And no directories were actually mentioned, how helpful...

The error came when it hit a line using matplotlib, it starts to create the figure

"fig, ax = plt.subplots(figsize=(15, 10))".

 

How can I fix that?

I thought it was something horrible related to the tkinter install setup, environment variables, wrong versions, etc as I was using an alternative python interpreter, not the python 3.7 that comes with FME Desktop as I couldn't install all the modules I wanted with that one.

 

Answer:

Edit the Python module imports for matplotlib to add the 2 lines in bold:

import matplotlib

matplotlib.use('Agg')

import matplotlib.pyplot as plt

import matplotlib.colors as clr

 

Apparently it has something to do with interactive and non interactive plotting.

I'm answering my own question now as don't know if there is a reputation requirement. And just generally for others if they encounter it and start getting worried about tcl, tkinter, etc

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.