Skip to content

Conversation

@oliveroxtoby
Copy link
Contributor

Running the FreeCAD daily build under Ubuntu 20.04, I have had the following error when the CfdOF workbench tries to create a plot:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/oliver/.FreeCAD/Mod/Plot/freecad/plot/Plot.py", line 110, in figure
    win = Plot(winTitle)
  File "/home/oliver/.FreeCAD/Mod/Plot/freecad/plot/Plot.py", line 423, in __init__
    self.canvas.setParent(self)
TypeError: arguments did not match any overloaded call:
  setParent(self, QWidget): argument 1 has unexpected type 'Plot'
  setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType]): argument 1 has unexpected type 'Plot'

This can be reproduced by entering the following in the python console.

from freecad.plot import Plot
Plot.figure("foo")

Further investigation revealed that on my system, when the modules are loaded, sys.modules contains 'PyQt.QtCore', causing matplotlib to select the PyQt5 API rather than PySide2 as it should. I don't know the reasons for this, but the attached commit forces matplotlib to select PySide2 by temporarily unloading the PyQt5.QtCore module if it is found.

@looooo looooo merged commit 8f66407 into FreeCAD:master Nov 16, 2020
@oliveroxtoby
Copy link
Contributor Author

Thanks! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants