|
[Sponsors] |
October 14, 2014, 11:41 |
library import error
|
#1 |
New Member
Join Date: Jan 2014
Posts: 4
Rep Power: 12 |
Hi,
I am new to this forum and also quite new to using OpenFOAM in general and PyFoam in special. PyFoam is a powerful tool and I am glad to be able to take advantage of its additional capabilities. However, when writing my own PyFoam I keep getting the following error: Traceback (most recent call last): File "readbb.py", line 2, in <module> from PyFoam.Execution.BasicRunner import BasicRunner File "/usr/lib/python2.6/site-packages/PyFoam/Execution/BasicRunner.py", line 14, in <module> from PyFoam.Basics.DataStructures import makePrimitiveString File "/usr/lib/python2.6/site-packages/PyFoam/Basics/DataStructures.py", line 5, in <module> import PyFoam.Basics.FoamFileGenerator File "/usr/lib/python2.6/site-packages/PyFoam/Basics/FoamFileGenerator.py", line 5, in <module> from PyFoam.Basics.DataStructures import Vector,Field,Dimension,TupleProxy,DictProxy,Tensor ,SymmTensor,Unparsed,UnparsedList,Codestream,DictR edirection,BinaryList,BoolProxy ImportError: cannot import name Vector when I try to import PyFoam libraries at the beginning of a python script, e.g. by: import os, shutil from PyFoam.Execution.BasicRunner import BasicRunner I have python version 2.6.6 installed on a CentOS 6.5 machine, I am using OpenFOAM 2.3.0 and PyFoam 0.6.3 version (installation as root). I already checked some things recommended at the openfoam wiki homepage . Can anybody help me to fix this error? Any help is very appreciated, thank you in advance. Regards, Sebastian |
|
October 15, 2014, 07:13 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
October 15, 2014, 08:57 |
|
#3 |
New Member
Join Date: Jan 2014
Posts: 4
Rep Power: 12 |
Thank you for your feedback, Bernhard.
I have checked the /usr/lib/python2.6/site-packages/PyFoam/Basics/DataStructures.py file as you mentioned and I found the vector structure inside it: class Vector(FixedLength): def __init___(self,x,y,z): FixedLength.__init__(self,[x,y,z]) (...) It is the same definition as in the downloaded tar. I also did a reinstallation and I am sure not to have manipulated it by myself. Maybe it is worth mentioning that single PyFoam applications (e.g. pyFoamPlotRunner.py) work as well as does a script that includes libraries from the 'applications' folder of PyFoam. Best, Sebastian |
|
October 15, 2014, 09:58 |
|
#4 |
New Member
Join Date: Jan 2014
Posts: 4
Rep Power: 12 |
I just found out that everything works out fine on my working machine if I download and install PyFoam version 0.6.2 instead.
So from what I've found out so far, the problem seems to have something to do with pyfoam version 0.6.3. But I still don't get why. Regards, Sebastian |
|
October 15, 2014, 12:07 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
from PyFoam.Basics import DataStructures Code:
from PyFoam.Basics import FoamFileGenerator from PyFoam.Basics import DataStructures Added a ticket on Sourceforge: https://sourceforge.net/p/openfoam-e...etspyfoam/219/
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request Last edited by gschaider; October 15, 2014 at 12:18. Reason: Ticket added |
||
October 15, 2014, 12:41 |
|
#6 |
New Member
Join Date: Jan 2014
Posts: 4
Rep Power: 12 |
Thanks a lot for this information. It helped and solved the problem! If I start my script with
import os, shutil from PyFoam.Basics import FoamFileGenerator from PyFoam.Execution.BasicRunner import BasicRunner the error message stated above doesn't appear anymore and it also works for PyFoam version 0.6.3. So in fact, it seems to have been a circular-dependency problem. Anyway starting the python script with import os, shutil from PyFoam.Execution.BasicRunner import BasicRunner didn't give any errors in PyFoam 0.6.2 version. This is what I was trying to express with my last post. So my guess is that inter-dependencies of different pyfoam classes might have changed for the new version So thank you again, regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Could not import tets | Aeronautics El. K. | Pointwise & Gridgen | 6 | April 27, 2023 03:38 |
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries | NickG | OpenFOAM Installation | 3 | December 30, 2019 01:21 |
[blockMesh] blockMesh with double grading. | spwater | OpenFOAM Meshing & Mesh Conversion | 92 | January 12, 2019 10:00 |
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) | Yogini | Fluent UDF and Scheme Programming | 7 | October 3, 2012 08:24 |
checking the system setup and Qt version | vivek070176 | OpenFOAM Installation | 22 | June 1, 2010 13:34 |