Skip to content
Advertisement

RPyC – inherit from exposed class

I have an RpyC server that imports a specific module, a class inside this module should be exposed so that this class can then be inherited from the client side.

For testing purposes I removed the module importing/exposing and created a simple class inside my RPyC service called exposed_TestClass.

server side: rpyc_server.py

JavaScript

client side: python3 shell

JavaScript

Advertisement

Answer

As per the documentation on: https://rpyc.readthedocs.io/en/latest/tutorial/tut2.html

Voila, netrefs (network references, also known as transparent object proxies) are special objects that delegate everything done on them locally to the corresponding remote objects. Netrefs may not be real lists of functions or modules, but they “do their best” to look and feel like the objects they point to… in fact, they even fool python’s introspection mechanisms!

on the client side, if you do:

JavaScript

it will print out:

JavaScript

So when trying to do:

JavaScript

You inherit from the proxy class definition but not from the remote class definition. So when documentation states

they “do their best”

, i think it exclude the possibility of doing inheritance from a remote class. I’ll be more than glad if ever someone can find a way to met your requirment.

Please note I made my tests by setting up the server using the following line:

JavaScript
Advertisement