CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   ImportError: No module named PyFoam.RunDictionary.ParsedParameterFile (https://www.cfd-online.com/Forums/openfoam/198628-importerror-no-module-named-pyfoam-rundictionary-parsedparameterfile.html)

jimswa February 13, 2018 03:23

ImportError: No module named PyFoam.RunDictionary.ParsedParameterFile
 
Hello!

In my OpenFoam case I launched a Python file. In the beginning of the script I want to import the ParsedParameterFile by the command:

from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile


But I always get the error:confused::

ImportError: No module named PyFoam.RunDictionary.ParsedParameterFile

I would be grateful if you could help me!:rolleyes:

Blumenkind November 27, 2018 11:40

I had the same problem. Switching the Python Intepreter to my version of Python 2 solved it for me. Can anybody confirm?
On the PyFoam-Wikipage it is written, that Python 3 is generally supported, but only Python 3.4 is tested. Is my version of Python 3 (3.6.7) the problem?

Edit: OK, seems like I just need to set the path for Python3 and try again. Will do tomorrow...


Edit2: PyFoam is installed in the Python 2.7-Folder. If I want to run it with Python3, the path has to be set with the following lines. (It may cause problems, if you have the same dist-packages in python2.7 as in python3)
Code:

import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages'



All times are GMT -4. The time now is 18:35.