0

I am trying to execute pvpython (from ParaView) in Linux. The problem is that when I try to execute pvpython by typing

python2 -i $HOME/Downloads/ParaView-5.10/bin/pvpython

I get an error:

 SyntaxError: Non-ASCII character '\x84' in file pvpython on line 2,but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details.

If I go on the site for details it says that I should change the source code so that python would be able to read non-ASCII characters. What should I do? By tiping file pvpython i get :

pvpython: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=681d55b0ca9429ce73a34b642ee7500fc91b52c2, not stripped

Also,the output of locale gives me LANG:en_IE.UTF-8 and LC_ALL=

Is the source file that I have to modify bash.rc? And what should I change?

gioggior
  • 13
  • 5
  • 1
    The full traceback should indicate which file contained the error. We can't tell which encoding the file uses without examining it (and perhaps not even then), but perhaps see https://meta.stackoverflow.com/questions/379403/problematic-questions-about-decoding-errors for a very brief primer. – tripleee Apr 08 '22 at 16:39
  • In the absence of any additional information, I guess the message pertains to the file `../pvpython`. If the file is indeed a Python script, examining its second line might provide some clues. If it isn't, something more fundamental is wrong in your (unstated) assumptions, which perhaps then you should [edit] to elaborate on. Where did you get the file from; is there an instruction you are attempting to follow which you can link to for us? – tripleee Apr 08 '22 at 16:46
  • Can you give us some links to where to get pvpython? From what I've seen so far, pvpython is an executable, not a python program. But that's just from my search results. – tdelaney Apr 08 '22 at 16:49
  • You may be trying to execute a Python 3 script with Python 2 because the PEP referred to it for the latter. Python 3 assumes source files are UTF-8, but in Python 2 you need to add a comment near the beginning of script when one is not ASCII. You many be able to get things to work by setting the `PYTHONIOENCODING=UTF-8` environment variable beforehand which changes the assumed encoding (instead of changing the source file). – martineau Apr 08 '22 at 16:51
  • pvpython is found in the Paraview directory when downloading it. I am trying to run a program to convert a molecular dynamics simulation output file into readable files for Paraview (I can attach the file if it's necessary), and to run that i should use the pvpython located in the bin folder. Sorry for the few/wrong informations but I'm still just a beginner. – gioggior Apr 08 '22 at 17:05

1 Answers1

1

pvpython is the interpreter, and as you already verified it's a

ELF 64-bit LSB executable,...

then what you have to run to execute your script is

$HOME/Downloads/ParaView-5.10/bin/pvpython my-script.py
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • It does not work it returns the same error – gioggior Apr 08 '22 at 17:35
  • 1
    copy the exact error after running above command or try `$HOME/Downloads/ParaView-5.10/bin/pvpython --help` – Diego Torres Milano Apr 08 '22 at 17:48
  • For ref, the pvpython [doc](https://docs.paraview.org/en/latest/UsersGuide/introduction.html#getting-started-with-pvpython) Also note that ParaView 5.10 does not support python2 (see [release note](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Documentation/release/ParaView-5.9.0.md) – Nico Vuaille Apr 11 '22 at 08:15
  • You'll receive a similar error if you try `python3 -i /bin/ls` (*because you are trying to interpret an ELF*) – Diego Torres Milano Apr 11 '22 at 20:29