access to files on pvserver host from python shell when using paraview GUI on pvserver client

Hello,
I want to access some files (eg. data.csv) from paraview GUI on the python shell, by reading it for example using pandas library. this work when working on my computer, but sometimes i connect to a remote server, and would like to load with pandas also files on the server, when doing this i get the error that the path does not exist (if i use the absolute path on the server). i saw this post form 6 years ago about this, but could not make it work.

  1. is it possible to simply add a line before trying to read the file so the absolute paths can be readed directly? or should I modfy the paths to be able to read it?
  2. if 1. is possible, is it also doable from a python script to check if paraview is connected currently to a server or not?

what I would like to be able to do, is run a python script, from the GUI on the client, which will have a path of a file (absolute path on the server side) and will import it with modiying the path as necessary (or leaving it as is in case that the script is runned from the server directly).
is this feasable?
thanks in advance.

You mean you read the file yourself using a python script run by pvpython ?
You obvously only have access to your own filesystem there.

If you want to read it remotely, you need a programmable source to do that, assuming you want to process the data with ParaView of course.

Hello mathieu,
I have a list of functions that i created in python such as (for give an example) ‘readCSV’ where as input it has pathOfFile.

i am connected to the workstation from my pc, by the connect of the paraview GUI using the ssh.
i would like to use readCSV(pathOfFileOnServerSide) on the python shell.

currently the python shell only finds the files on the client pc (my pc) so for example, even thought pathOfFileOnServerSide exists on the workstation, on my pc it does not so i get an error when running readCSV(pathOfFileOnServerSide) telling me that the file/path does not exist.

what i would like to do, is to add (one or severals) on the python script that I import to have readCSV:

  • add a flag to say i am running it in ssh setup so the function will modify the pathOfFileOnServerSide to be able to read it (i dont know about ssh etc, but to be clear, something like:
def readCSV(path='C/myDocsOnServer', onServer=True):
  if onServer:
     path='1.186.123'+'/'+path
  continue with the function.....
  • that when the imported python file is imported, it checks if the current GUI is connected to ssh, and if it is, it will run something like connect_to_folders_on_server function so then i can use the readCSV (and other functions) with the classic global path on the server without needing to modify it as in the previous point.

Ok but why ? What do you do with this data afterward ?

I put it as example, but I have some funcitons to save values in my own formating, such as time tables with different integrated values etc; i also integrated the post processing of the extracted data to my paraview codes. what I mostly do is to extract specific data of my simulation, save it as CSVs and other data formats in text files, and also read this files from other already post processed simulations, so i can compare between them directly from the python shell in paraview.

So you do your own post processing unrelated to paraview feature.

If you want to be able to do that server side you must implement that using a programmable source/filter or a python plugin, you cannot do that in pvpython unless you copy the data from the server to the client.

So you do your own post processing unrelated to paraview feature.

well right now, yes, but maybe in the future bring back this information to paraview itself, such as eg. have a text label with f’the efficiency is equal to {conversion1/conversion0}’ where conversion1 i calculated in paraview, and conversion0 i calcualted also with paraview but in a previous instance that i saved in txt and readed with my own functions.

If you want to be able to do that server side you must implement that using a programmable source/filter or a python plugin

python pluging i am not looking for as it would not be possible to integrate inside my generic python functions, a programmable source/filter would be exactly what I look for. any recommendations on info or how to on doing this? not sure where to look or what keyword to use for begining looking

you cannot do that in pvpython unless you copy the data from the server to the client.

this could be a work around, but sure how to bring it from the server to the client…

thanks in any case mathieu, as always super helpfull