gv871
April 7, 2022, 9:53am
1
Hello,
I would like to use the remote directory where the pvserver command is executed.
I tried to follow the suggestion in this answer
In my server machine I am running pvserver:
mpiexec -np 12 pvserver
On my local machine I could easily connect to the server machine and from File > Open I could browse files on the server but when I run Python Shell (View > Python Shell) I don’t know how to access the remote files:
import os
os.getcwd() # This returns the path in the local machine not in the remote server.
How can I access remote server files from within Python Shell in the local machine?
but I got nowhere.
If I execute the following
pxm = paraview.servermanager.ProxyManager()
directory_proxy = pxm.NewProxy('misc', 'ListDirectory')
fileList = paraview.servermanager.VectorProperty(directory_proxy,directory_proxy.GetProperty('FileList'))
directoryList = paraview.servermanager.VectorProperty(directory_proxy,directory_proxy.GetProperty('DirectoryList'))
print(directoryList)
the code print a None
.
While I would like to have somethig like: /home/user
Thank you for any suggestion you can give me.
jourdain
(Sebastien Jourdain)
April 7, 2022, 3:33pm
2
Those are meant to list content of a directory on the server side. You need to provide the path to check on the server. That’s why you are getting None. The path to check is invalid.
You need to feed that information to that proxy . I’m not sure if a special string could be used to evaluate the user home like $HOME
?
gv871
April 8, 2022, 7:30am
3
Thanks for the answer. If I try to use a system variable
os.environ.get('HOME')
it will always use the variable in the local system. is there any other solution to let python script where on the server it is executed?
jourdain
(Sebastien Jourdain)
April 8, 2022, 3:56pm
4
I don’t know on top of my head. That’s why I mentioned string
for doing something like
directory_proxy.List("$HOME/some/sub/path")
as that string would be evaluated on the server side and not on the client.