CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[PyFoam] PyFoam under Windows 10

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2024, 08:51
Default PyFoam under Windows 10
  #1
Member
 
Giorgio
Join Date: Mar 2023
Posts: 46
Rep Power: 3
giorgianig is on a distinguished road
I am trying to use PyFoam on Windows 10 to postprocess my OpenFoam cases (I am running OpenFOAM on WSL and works perfectly)


I have installed PyFoam using pip

Code:
 C:\Users\giorgio.giorgiani>pip install PyFoam   

Collecting PyFoam
Using cached PyFoam-2023.7-py2.py3-none-any.whl.metadata (3.6 kB) 

Requirement already satisfied: numpy in c:\users\giorgio.giorgiani\appdata\local\programs\python\python311\lib\site-packages (from PyFoam) (1.26.4)
Requirement already satisfied: jinja2 in c:\users\giorgio.giorgiani\appdata\local\programs\python\python311\lib\site-packages (from PyFoam) (3.1.3)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\giorgio.giorgiani\appdata\local\programs\python\python311\lib\site-packages (from jinja2->PyFoam) (2.1.5) 

Using cached PyFoam-2023.7-py2.py3-none-any.whl (697 kB) 

Installing collected packages: PyFoam 

Successfully installed PyFoam-2023.7
However when I write on the terminal pyFoamVersion.py I get the following error:



Code:
 C:\Users\giorgio.giorgiani>pyFoamVersion.py
Traceback (most recent call last):
File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Scripts\pyFoamVersion.py", line 9, in <module> 

   from PyFoam.ThirdParty.six import print_ 

File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\__init__.py", line 7, in <module> 

   from PyFoam.Infrastructure.Configuration import Configuration
File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Infrastructure\Configuration.py", line 85, in <module>
 "descriptionPath": eval('["'+path.curdir+'","'+path.join(userDirectory(),"caseBuilderDescriptions")+'","'+path.join(globalDirectory(),"caseBuilderDescriptions")+'"]'),
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "<string>", line 1
  [".","C:\Users\giorgio.giorgiani\.pyFoam\caseBuilderDescriptions","/etc\pyFoam\caseBuilderDescriptions"]
                                                                   ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
I think there is a problem in the global path definition in Hardcoded.py


Code:
def globalDirectory():
    """:return: the global directory"""
    return path.join("/etc",_pyFoamDirName)
which is causing the crash due to the backslash (..?..)

Does anybody have an idea?


Thanks in advance
giorgianig is offline   Reply With Quote

Old   March 26, 2024, 10:07
Default
  #2
Member
 
Giorgio
Join Date: Mar 2023
Posts: 46
Rep Power: 3
giorgianig is on a distinguished road
I found the solution:



https://sourceforge.net/p/openfoam-e...etspyfoam/226/


Hope this helps someone in the future
giorgianig is offline   Reply With Quote

Old   March 27, 2024, 04:52
Default
  #3
Member
 
Giorgio
Join Date: Mar 2023
Posts: 46
Rep Power: 3
giorgianig is on a distinguished road
Is there anyone who have experience using pyFoam under Windows?
I cannot manage this thing to work. After solving the previous problem, now I am facing this:



Code:
===================================================================== RESTART: C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\plotResiduals.py =====================================================================
PyFoam WARNING on line 382 of file C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Applications\PyFoamApplication.py : $WM_PROJECT_VERSION unset. PyFoam will not be able to determine the OpenFOAM-version and behave strangely 
Traceback (most recent call last):
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 853, in move
    os.rename(src, real_dst)
PermissionError: [WinError 32] Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus: 'C:\\Users\\giorgio.giorgiani\\Ubuntu\\rootfs\\home\\giorgio\\OpenFOAM\\2212\\tutorials\\incompressible\\icoFoam\\cavity\\cavity\\log.icofoam.analyzed\\pickledPlots.tmp' -> 'C:\\Users\\giorgio.giorgiani\\Ubuntu\\rootfs\\home\\giorgio\\OpenFOAM\\2212\\tutorials\\incompressible\\icoFoam\\cavity\\cavity\\log.icofoam.analyzed\\pickledPlots'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\plotResiduals.py", line 3, in <module>
    PlotWatcher.PlotWatcher(path)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Applications\PlotWatcher.py", line 45, in __init__
    PyFoamApplication.__init__(self,
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Applications\PyFoamApplication.py", line 496, in __init__
    result=self.run()
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Applications\PlotWatcher.py", line 206, in run
    run.start()
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Execution\BasicWatcher.py", line 133, in start
    self.lineHandle(line)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Execution\AnalyzedCommon.py", line 181, in lineHandle
    self.analyzer.analyzeLine(line)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\LogAnalysis\FoamLogAnalyzer.py", line 213, in analyzeLine
    self.analyzers[nm].doAnalysis(line)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\LogAnalysis\TimeLineAnalyzer.py", line 46, in doAnalysis
    self.notifyNewTime(m)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\LogAnalysis\TimeLineAnalyzer.py", line 34, in notifyNewTime
    self.notify(float(m.group(2)))
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\LogAnalysis\LogLineAnalyzer.py", line 74, in notify
    f(*data)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\LogAnalysis\FoamLogAnalyzer.py", line 147, in setTime
    listener.timeChanged()
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Execution\GnuplotRunner.py", line 350, in timeChanged
    StepAnalyzedCommon.timeChanged(self)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Execution\StepAnalyzedCommon.py", line 43, in timeChanged
    self.picklePlots()
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\site-packages\PyFoam\Execution\AnalyzedCommon.py", line 608, in picklePlots
    move(pickleFile+".tmp",pickleFile)
  File "C:\Users\giorgio.giorgiani\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 874, in move
    os.unlink(src)
PermissionError: [WinError 32] Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus: 'C:\\Users\\giorgio.giorgiani\\Ubuntu\\rootfs\\home\\giorgio\\OpenFOAM\\2212\\tutorials\\incompressible\\icoFoam\\cavity\\cavity\\log.icofoam.analyzed\\pickledPlots.tmp'
giorgianig is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with PyFoam and batch file! alfogianco OpenFOAM Running, Solving & CFD 0 January 5, 2022 08:57
Analyzing log with PyFoam without GNUPlot windows inabower OpenFOAM Running, Solving & CFD 1 January 10, 2019 04:45
[PyFoam] for Windows? Vitterfolk OpenFOAM Community Contributions 14 November 29, 2016 05:29
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 06:25


All times are GMT -4. The time now is 17:47.