Closed
Description
while probably not actually related causally, this is definitely in the same code as issue #440
Client and server version 0.4.4, running Python client on python 3.5.2 on windows
When I attempt to create an 'and' expression with code like below:
alt_expr = conn.krpc.Expression.and_(
alt_gen(
conn.krpc.Expression.call(alt_callable),
conn.krpc.Expression.constant_double(altitude)
),
v_speed_gen(
conn.krpc.Expression.call(v_speed_callable),
conn.krpc.Expression.constant_double(0)
)
)
event = conn.krpc.add_event(alt_expr)
I get an error that Expression has no attribute 'and_'.
Traceback (most recent call last):
File "tutorials/sub_orbital.py", line 42, in <module>
run()
File "tutorials/sub_orbital.py", line 37, in run
hb_ksp.vessel.wait_for_surface_altitude_event(conn, vessel, 4000, direction=const.DESCENDING)
File "c:\users\tyler jachetta\projects\ksp_scripts\src\hb_ksp\hb_ksp\vessel.py", line 69, in wait_for_surface_altitude_event
event = get_surface_altitude_event(conn, vessel, altitude)
File "c:\users\tyler jachetta\projects\ksp_scripts\src\hb_ksp\hb_ksp\vessel.py", line 54, in get_surface_altitude_event
alt_expr = conn.krpc.Expression.and_(
AttributeError: type object 'Expression' has no attribute 'and_'
This is further confirmed when I attempt to look at the Expression object in the REPL:
>>> krpc.__version__
'0.4.4'
>>> conn = util.get_conn('test')
>>> conn
<krpc.client.Client object at 0x0000023408A1C2E8>
>>> conn.krpc.Expression.and_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Expression' has no attribute 'and_'
>>> dir(conn.krpc.Expression)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_add_method', '_add_property', '_add_static_method', '_class_name', '_client', '_service_name', 'add', 'aggregate', 'aggregate_with_seed', 'all', 'and', 'any', 'average', 'call', 'cast', 'concat', 'constant_bool', 'constant_double', 'constant_float', 'constant_int', 'constant_string', 'contains', 'count', 'create_dictionary', 'create_list', 'create_set', 'create_tuple', 'divide', 'equal', 'exclusive_or', 'function', 'get', 'greater_than', 'greater_than_or_equal', 'invoke', 'left_shift', 'less_than', 'less_than_or_equal', 'max', 'min', 'modulo', 'multiply', 'not', 'not_equal', 'or', 'order_by', 'parameter', 'power', 'right_shift', 'select', 'subtract', 'sum', 'to_list', 'to_set', 'where']
>>>
Am I doing something wrong here? I haven't delved too deep into krpc yet, but this is really confusing me right now.