0

I am getting an error when trying to run code and am unsure how to solve the issue. I am unsure what this datapath is and the error is coming straight from the matplotlib package. Any help is greatly appreciated. Here is the error I am getting:

running API pyqt5
using configuration at /home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/image_analyzer.conf
no Pyro installed. Use dummy event handler.
/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/mplwidget.py:123: MatplotlibDeprecationWarning:
The _init_toolbar method was deprecated in Matplotlib 3.3 and will be removed two minor releases later. Please fully initialize the toolbar in your subclass' __init__; a fully empty _init_toolbar implementation may be kept for compatibility with earlier versions of Matplotlib.
  super(Toolbar, self).__init__(*args, **kwargs)
Traceback (most recent call last):
  File "start.py", line 5, in <module>
    dmw, app, reuseapp = main.run_app()
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/main.py", line 552, in run_app
    dmw = DesignerMainWindow()
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/main.py", line 33, in __init__
    self.setupUi(self)
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/gui.py", line 333, in setupUi
    self.main_area = self.setup_main_area(self.main_widget)
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/gui.py", line 306, in setup_main_area
    center_area = self.setup_center_area(main_area)
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/gui.py", line 196, in setup_center_area
    self.main_image_plot = MplWidget(self.tabs[0])
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/mplwidget.py", line 109, in __init__
    self.mpl_toolbar = Toolbar(self.figCanvas, self)
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/mplwidget.py", line 123, in __init__
    super(Toolbar, self).__init__(*args, **kwargs)
  File "/home/.local/lib/python3.8/site-packages/matplotlib/backends/backend_qt5.py", line 681, in __init__
    NavigationToolbar2.__init__(self, canvas)
  File "/home/.local/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2913, in __init__
    init()
  File "/home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/mplwidget.py", line 140, in _init_toolbar
    self.basedir = os.path.join(mpl.rcParams["datapath"], "images")
  File "/home/.local/lib/python3.8/site-packages/matplotlib/__init__.py", line 623, in __getitem__
    return dict.__getitem__(self, key)
KeyError: 'datapath'

start.py file:

#!/bin/env python
from qimageanalyser import main
import sys

dmw, app, reuseapp = main.run_app()
if "app" in globals() and not reuseapp:
    sys.exit(app.exec_())

image_analyzer.conf file (I have to write more text to post this so I am writing more text here):

[Analysis Functions]
fitter = gaussian
analyser = absorption2
clearonnewrun = False

[General]
atom = Li6
nPics = 2
default_ref_roi_xi = 0
default_ref_roi_yi = 0
default_ref_roi_xf = 40
default_ref_roi_yf = 100

[Gui]
colorscale = jet

[Guppy]
pixelarea = 329.28e-12
magnification = 0.33

[Manta]
pixelarea = 64e-12
magnification = 2.5

[None]
pixelarea = 100e-12
magnification = 1

[Li6]
crosssection = 2.14949894091e-13
clebsch = 0.5
mass = 6

[Li7]
crosssection = 2.14949894091e-13
clebsch = 0.5
mass = 7

[Na]
crosssection = 1.6564257603715025E-13
clebsch = 1
mass = 23
4
  • might it be something in your configuration file? You haven't included your code, so there's not much to go by. Commented Aug 6, 2021 at 9:49
  • Which configuration file? I could post the gui.py file and the mplwidget.py file but they are pretty long Commented Aug 6, 2021 at 9:50
  • This one: /home/Desktop/Arbeit/image_analyzer_files/imageanalyser/qimageanalyser/image_analyzer.conf. What is start.py? Commented Aug 6, 2021 at 9:51
  • I just updated the post with star.py and image_analyzer.conf. I'm not sure what could be wrong in the .conf file. Commented Aug 6, 2021 at 9:55

1 Answer 1

4

mpl.rcParams["datapath"] was deprecated: https://github.com/matplotlib/matplotlib/pull/16417

Solution is to use

mpl.get_data_path()

instead of

mpl.rcParams["datapath"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.