I am trying to use a function within a RPyC
threaded server which returns the dict
containing file attributes such as location, filename by looping over all the folders within the specified path.
However, when this is returned back to client, the list object (fl) is of type
<netref class 'rpyc.core.netref.builtins.list'>
which I try to convert to a list using
ft= list(ft)
but this too converts it to '<class 'list'>
' and not 'list'
as expected.
I'd like this to be converted to a dataframe but using 'df = pd.DataFrame(fl)
' returns an error 'AttributeError: cannot access 'keys'
RPyC server function:
The closest I came to finding a related response was in this post but I still don't know if I understand this right. Is there a way to put this into a dataframe or convert to normal list which can then be converted easily? Any help is appreciated.
Server:
PATH = r"C:\Temp"
def exposed_fquery():
fl = []
for (dpath, dname, fname) in os.walk(PATH):
for f in fname:
td = {}
td['Location'] = dpath
td['Name'] = f
fl.append(td)
print (fl)
return (fl)
Client:
con = rpyc.connect('localhost',5000)
s = con.root.Server()
filemap = s.fquery(index)
print (type(filemap), "\n", filemap)
print (type(ft), "\n",ft)
ft= list(ft)
print (type(ft))
Result:
<netref class 'rpyc.core.netref.builtins.list'>
[{'Location': 'C:\\Temp\\', 'Name': 'file1.txt'}, {'Location': 'C:\\Temp\\', 'Name': 'Test.txt'}]
<class 'list'>