Question

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


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


0 replies

Be the first to reply!

Reply