tomerfiliba-org / rpyc

RPyC (Remote Python Call) - A transparent and symmetric RPC library for python
http://rpyc.readthedocs.org
Other
1.57k stars 243 forks source link

Datetime Comparison error #378

Open itaistopel opened 4 years ago

itaistopel commented 4 years ago
-----------------------------------------------------------------------
AttributeError                        Traceback (most recent call last)
<ipython-input-3-8c747544e8c8> in <module>()
----> 1 a < b

/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in __cmp__(self, other)
    186 
    187     def __cmp__(self, other):
--> 188         return syncreq(self, consts.HANDLE_CMP, other, '__cmp__')
    189 
    190     def __eq__(self, other):

/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in syncreq(proxy, handler, *args)
     74     """
     75     conn = object.__getattribute__(proxy, "____conn__")
---> 76     return conn.sync_request(handler, proxy, *args)
     77 
     78 

/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.pyc in sync_request(self, handler, *args)
    467         """
    468         timeout = self._config["sync_request_timeout"]
--> 469         return self.async_request(handler, *args, timeout=timeout).value
    470 
    471     def _async_request(self, handler, args=(), callback=(lambda a, b: None)):  # serving

/usr/local/lib/python2.7/dist-packages/rpyc/core/async_.pyc in value(self)
    100         self.wait()
    101         if self._is_exc:
--> 102             raise self._obj
    103         else:
    104             return self._obj

AttributeError: type object 'datetime.datetime' has no attribute '__cmp__'

========= Remote Traceback (1) =========
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 320, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 585, in _handle_cmp
    return self._access_attr(type(obj), op, (), "_rpyc_getattr", "allow_getattr", getattr)(obj, other)
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 537, in _access_attr
    return accessor(obj, name, *args)
AttributeError: type object 'datetime.datetime' has no attribute '__cmp__'
Environment
Minimal example
>>> import rpyc
>>> con=rpyc.classic.connect_subproc('/usr/local/bin/rpyc_classic.py')
>>> a = con.modules.datetime.datetime.now()
>>> a
datetime.datetime(2020, 3, 16, 12, 52, 42, 525389)
>>> import datetime
>>> b = datetime.datetime.now()
>>> b
datetime.datetime(2020, 3, 16, 12, 52, 56, 760635)
>>> a < b
-----------------------------------------------------------------------
AttributeError                        Traceback (most recent call last)
<ipython-input-3-8c747544e8c8> in <module>()
----> 1 a < b

/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in __cmp__(self, other)
    186 
    187     def __cmp__(self, other):
--> 188         return syncreq(self, consts.HANDLE_CMP, other, '__cmp__')
    189 
    190     def __eq__(self, other):

/usr/local/lib/python2.7/dist-packages/rpyc/core/netref.pyc in syncreq(proxy, handler, *args)
     74     """
     75     conn = object.__getattribute__(proxy, "____conn__")
---> 76     return conn.sync_request(handler, proxy, *args)
     77 
     78 

/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.pyc in sync_request(self, handler, *args)
    467         """
    468         timeout = self._config["sync_request_timeout"]
--> 469         return self.async_request(handler, *args, timeout=timeout).value
    470 
    471     def _async_request(self, handler, args=(), callback=(lambda a, b: None)):  # serving

/usr/local/lib/python2.7/dist-packages/rpyc/core/async_.pyc in value(self)
    100         self.wait()
    101         if self._is_exc:
--> 102             raise self._obj
    103         else:
    104             return self._obj

AttributeError: type object 'datetime.datetime' has no attribute '__cmp__'

========= Remote Traceback (1) =========
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 320, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 585, in _handle_cmp
    return self._access_attr(type(obj), op, (), "_rpyc_getattr", "allow_getattr", getattr)(obj, other)
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/protocol.py", line 537, in _access_attr
    return accessor(obj, name, *args)
AttributeError: type object 'datetime.datetime' has no attribute '__cmp__'
itaistopel commented 4 years ago

@comrumino @tomerfiliba Hi. Anything new about that?

comrumino commented 4 years ago

Sorry for the delay. I am unable to reproduce the issue on my end. Are you using an interactive terminal within an IDE or something? ipython-input-3-8c747544e8c8 looks like an exception in an ipython interpeter. Can you reproduce the issue in a clean venv?

itaistopel commented 4 years ago

@comrumino Weird. I was able to reproduce this issue in multiple envs. Have you executed the exact python code as I did?

itaistopel commented 4 years ago

Just to remind, it is python 2