Seems your version of Paraview is compiled with Python3 instead of Python2. Which is not bad but a bit unusual: the binaries that KitWare delivers are still using python2 so the problem didn't bite anyone yet.
At the time that these utilies were made Paraview didn't even pretend to support Python3 so I never bothered to make the sources compatible with Python2 and Python3
The first problem (changed syntax for print) you did already solve. Athough a better solution would be to use
fromPyFoam.ThirdParty.siximportprint_
and then use print_ instead of print. That way it would be compatible with python2 and 3
The second problem is a change in the way Python3 imports modules that are in the same directory. Replace
fromPyFoamApplicationimportPyFoamApplication
with
from.PyFoamApplicationimportPyFoamApplication
and everything should be fine. Except for possible other errors that haven't surfaced yet.
Should these changes be sufficient could you please attach the modified file here and I'll work them into the code-base. Otherwise I'll have a look next week in the office where I happen to have a virtual machine with Manjaro. What I'd need to know: where did you get the paraview with python3?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Bernhard Gschaider,
yes, I've compiled Paraview myself from this Aur: https://aur.archlinux.org/packages/paraview/
After making the changing your suggested, I get this output when executing PyFoamPVSnapshot.py
Executing PVSnapshot with pvpython trough a proxy-script options:
Traceback (most recent call last):
File "/tmp/pyFoamPVSnapshot_i61_e_7z.py", line 4, in <module>
PVSnapshot()
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PVSnapshot.py", line 54, in __init__
**kwargs)
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 326, in __init__
self.addOptions()
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PVSnapshot.py", line 85, in addOptions
help="The type of the bitmap-file. Possibilities are "+", ".join(self.picTypeTable.keys())+". Default: %default")
File "/usr/lib/python3.6/optparse.py", line 1000, in add_option
option = self.option_class(*args, **kwargs)
File "/usr/lib/python3.6/optparse.py", line 581, in __init__
checker(self)
File "/usr/lib/python3.6/optparse.py", line 670, in _check_choice
% str(type(self.choices)).split("'")[1], self)
optparse.OptionError: option --type: choices must be a list of strings ('dict_keys' supplied)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Traceback (most recent call last):
File "/tmp/pyFoamPVSnapshot_a5fzq24y.py", line 4, in <module>
PVSnapshot()
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PVSnapshot.py", line 54, in __init__
**kwargs)
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 326, in __init__
self.addOptions()
File "/home/robin/miniconda3/lib/python3.6/site-packages/PyFoam/Applications/PVSnapshot.py", line 113, in addOptions
help="The type of the geometry-files. Possibilities are "+", ".join(self.geomTypeTable.keys())+". Default: unset. Nothing is written")
File "/usr/lib/python3.6/optparse.py", line 1000, in add_option
option = self.option_class(*args, **kwargs)
File "/usr/lib/python3.6/optparse.py", line 581, in __init__
checker(self)
File "/usr/lib/python3.6/optparse.py", line 670, in _check_choice
% str(type(self.choices)).split("'")[1], self)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems your version of Paraview is compiled with Python3 instead of Python2. Which is not bad but a bit unusual: the binaries that KitWare delivers are still using python2 so the problem didn't bite anyone yet.
At the time that these utilies were made Paraview didn't even pretend to support Python3 so I never bothered to make the sources compatible with Python2 and Python3
The first problem (changed syntax for print) you did already solve. Athough a better solution would be to use
and then use
print_
instead ofprint
. That way it would be compatible with python2 and 3The second problem is a change in the way Python3 imports modules that are in the same directory. Replace
with
and everything should be fine. Except for possible other errors that haven't surfaced yet.
Should these changes be sufficient could you please attach the modified file here and I'll work them into the code-base. Otherwise I'll have a look next week in the office where I happen to have a virtual machine with Manjaro. What I'd need to know: where did you get the paraview with python3?
Hello Bernhard Gschaider,
yes, I've compiled Paraview myself from this Aur: https://aur.archlinux.org/packages/paraview/
After making the changing your suggested, I get this output when executing PyFoamPVSnapshot.py
Replacing
with
might do the trick
Unfortunatly this does not work: