[Django]-Mpld3 inside of Django Views – "NoneType" Object has no attribute "split"

4👍

I guess the code is running on a server, which does not have any graphical output. Hence creating the figure may fail. You may use a non-GUI backend, like

import matplotlib
matplotlib.use("Agg")
import mpld3
import matplotlib.pyplot as plt
# ... rest of code

2👍

Are you calling this from another thread?
TKinter needs to run in the main thread.

Please check whether these similar questions help in solving your problem:
RuntimeError: main thread is not in main loop
https://www.reddit.com/r/learnpython/comments/69z9fs/error_main_thread_not_in_main_loop/

Leave a comment