KeyError: 'datapath' with Matplotlib
KeyError: 'datapath' with Matplotlib
我在尝试 运行 编码时遇到错误,我不确定如何解决这个问题。我不确定这个数据路径是什么,错误直接来自 matplotlib 包。任何帮助是极大的赞赏。这是我收到的错误:
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 文件:
#!/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 文件(我必须在 post 中写更多的文字,所以我在这里写更多的文字):
[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
mpl.rcParams["datapath"]
已弃用:https://github.com/matplotlib/matplotlib/pull/16417
解决方案是使用
mpl.get_data_path()
而不是
mpl.rcParams["datapath"]
我在尝试 运行 编码时遇到错误,我不确定如何解决这个问题。我不确定这个数据路径是什么,错误直接来自 matplotlib 包。任何帮助是极大的赞赏。这是我收到的错误:
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 文件:
#!/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 文件(我必须在 post 中写更多的文字,所以我在这里写更多的文字):
[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
mpl.rcParams["datapath"]
已弃用:https://github.com/matplotlib/matplotlib/pull/16417
解决方案是使用
mpl.get_data_path()
而不是
mpl.rcParams["datapath"]