[Solved] Error Closing CFD Mesh Task Panel using recent 0.19 Dev Win Build

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Post Reply
Syres
Veteran
Posts: 2898
Joined: Thu Aug 09, 2018 11:14 am

[Solved] Error Closing CFD Mesh Task Panel using recent 0.19 Dev Win Build

Post by Syres »

It would appear that either a commit to the FreeCAD code or the recent change of Qt from 5.6 to 5.12.1 in the Windows 0.19 dev builds has led to an error being generated in the Report View when closing the Cfd Mesh Task Panel (possibly others too):

Code: Select all

Traceback (most recent call last):
  File "C:\Users\JPS\AppData\Roaming\FreeCAD\Mod\CfdOF\_TaskPanelCfdMesh.py", line 130, in reject
    self.mesh_process.terminate()
  File "C:\Users\JPS\AppData\Roaming\FreeCAD\Mod\CfdOF\CfdConsoleProcess.py", line 74, in terminate
    self.process.write("terminate\n")
<class 'TypeError'>: 'PySide2.QtCore.QIODevice.write' called with wrong argument types:
  PySide2.QtCore.QIODevice.write(str)
Supported signatures:
  PySide2.QtCore.QIODevice.write(PySide2.QtCore.QByteArray)
I've updated my CfdOf Wb this morning to ensure I've not missed a recent commit to fix this.

The change I made to my local copy of CfdConsoleProcess at line 74 was from:

Code: Select all

            self.process.write("terminate\n")
to:

Code: Select all

            try:
                self.process.write("terminate\n")
            except:
                self.process.write(str.encode("terminate\n"))
I've tested it on both new Py3Qt5 builds as well as older 0.18 Py2Qt4 builds and it appears to work.
I'm open to those with far more Python knowledge as to a more clean solution.

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16935 (Git)
Build type: Release
Branch: master
Hash: aa9cd0d91c1db88bf2999a08987a31894e67f7f1
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Last edited by Syres on Wed Jun 12, 2019 1:41 pm, edited 1 time in total.
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Error Closing CFD Mesh Task Panel using recent 0.19 Dev Win Build

Post by oliveroxtoby »

Syres wrote: Mon Jun 10, 2019 3:31 pm It would appear that either a commit to the FreeCAD code or the recent change of Qt from 5.6 to 5.12.1 in the Windows 0.19 dev builds has led to an error being generated in the Report View when closing the Cfd Mesh Task Panel (possibly others too):
Thanks a lot for this! I have pushed a fix.
Please provide all the information requested in this post before reporting problems with CfdOF.
Syres
Veteran
Posts: 2898
Joined: Thu Aug 09, 2018 11:14 am

Re: Error Closing CFD Mesh Task Panel using recent 0.19 Dev Win Build

Post by Syres »

oliveroxtoby wrote: Wed Jun 12, 2019 8:22 am Thanks a lot for this! I have pushed a fix.
Tested your much neater solution successfully, thanks.
Post Reply