If I use FreeCAD 0.18.1, with Python 3, installed from the freecad-stable PPA, I get this error.
Code: Select all
import CfdTools
CfdTools.checkCfdDependencies()
Code: Select all
Checking CFD workbench dependencies...
Checking FreeCAD version
Traceback (most recent call last):
File "/home/ecc/.FreeCAD/Mod/CfdOF/CfdPreferencePage.py", line 159, in runDependencyChecker
msg = CfdTools.checkCfdDependencies()
File "/home/ecc/.FreeCAD/Mod/CfdOF/CfdTools.py", line 685, in checkCfdDependencies
gitver = ver[2].split()[0]
IndexError: list index out of range
Code: Select all
ver = FreeCAD.Version()
print(ver)
['0', '18.1', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2019/04/06 19:19:55']
On the other hand, if I use a development release of FreeCAD 0.18, which has a git number, it works.
Code: Select all
ver = FreeCAD.Version()
print(ver)
['0', '18', '16093 (Git)', 'git://github.com/FreeCAD/FreeCAD.git releases/FreeCAD-0-18', '2019/03/12 13:38:07', 'releases/FreeCAD-0-18', '690774c0effe4fd7b8d2b5e2fb2b8c8d145e21ce']
I think the checkCfdDependencies() function also does something like int(ver[1]). This also fails because the second element of the list is not an integer, but a float. That is, it tries to convert the string "18.1" to an integer and it fails. It works correctly if the string is "18", as in the development version.
So, I think these checks need some try: except: blocks to check for different styles of the version returned by FreeCAD.Version(). In particular, the check shouldn't fail with the "stable" version; it is disconcerting if a check seems to fail with software that is supposed to be "stable".
Code: Select all
try:
check if version is "18" with git commit "1246"
except:
parse another way to get "18.1" with no git commit
else:
assume the version is correct
Another issue. If I use the checkCfdDependencies() in the development version, 0.18, 16093 (Git), with Python 2, the output looks fine. The end of line characters are correctly recognized so the output is correctly spaced.
Code: Select all
Checking FreeCAD version
Checking for OpenFOAM:
Running echo $WM_PROJECT_VERSION
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && echo $WM_PROJECT_VERSION']
6
Running cartesianMesh -help
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && cartesianMesh -help']
Usage: cartesianMesh [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-fileHandler <handler>
...
Code: Select all
Checking FreeCAD version
Checking for OpenFOAM:
Running echo $WM_PROJECT_VERSION
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && echo $WM_PROJECT_VERSION']
b'6\n'Error parsing OpenFOAM version string b'6\n'
Running cartesianMesh -help
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && cartesianMesh -help']
b'\n'b'Usage: cartesianMesh [OPTIONS]\n'b'options:\n'b' -case <dir> specify alternate case directory, default is the cwd\n'b' -fileHandler <handler>\n'b' override the fileHandler\n'b' -hostRoots <(((host1 dir1) .. (hostN dirN))>\n'
...
I believe checkCfdDependencies() internally uses subprocess to run the tools in the command line, but maybe some options aren't correctly set up, so the output isn't being displayed correctly when run in Python 3.
---------
And finally. Paraview is not detected by checkCfdDependencies(). Not with the 0.18 development (16093) nor with the 0.18.1 stable version.
It was correctly installed. As I said, I can run the examples.
Code: Select all
which -a paraview
/opt/paraviewopenfoam56/bin/paraview
Code: Select all
paraview_cmd = "paraview"
# Otherwise, the command 'paraview' must be in the path - test to see if it exists
import distutils.spawn
if distutils.spawn.find_executable(paraview_cmd) is None:
Code: Select all
Running cartesianMesh -help
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && cartesianMesh -help']
Code: Select all
Running paraview
Raw command: ['bash', '-c', 'source "/opt/openfoam6/etc/bashrc" && paraview']
Code: Select all
try:
distutils.spawn.find_executable(paraview_cmd)
except:
runFoamCommand(paraview_cmd)
In this thread I'm only talking about the dependency check in the CfdOF preferences window (Edit -> Preferences -> CFD); I haven't checked if the actual operation of CfdOF fails because of this. Everything, OpenFoam, Paraview, cfMesh, and HiSA seem to be correctly installed. So, it is a case that the everything is installed but the software still reports problems. I think the dependency check should be more robust so as to not confuse new users that want to start using CfdOF.