kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

SpaceCenter API: vessel properties not available in all frames

swhinton opened this issue ยท 1 comments

commented

Problem Details

When in the space_center view, the properties of vessels in the list of vessels returned by the space_center.vessels API are not accessible. This is contrary to what the documentation specifies
https://krpc.github.io/krpc/python/api/space-center/space-center.html#SpaceCenter.vessels
https://krpc.github.io/krpc/python/api/space-center/vessel.html#SpaceCenter.Vessel.name

When a vessel property is read in the space_center game scene an exception is throw, e.g.
print(conn.space_center.vessels[0].name)

Will generate the following exception

File "/usr/local/lib/python3.6/dist-packages/krpc/client.py", line 163, in _invoke
    raise self._build_error(response.results[0].error)
krpc.error.RPCError: Object reference not set to an instance of an object
Server stack trace:
  at KRPC.SpaceCenter.FlightGlobalsExtensions.GetVesselById (Guid id) [0x00000] in <filename unknown>:0 
  at KRPC.SpaceCenter.Services.Vessel.get_InternalVessel () [0x00000] in <filename unknown>:0 
  at KRPC.SpaceCenter.Services.Vessel.get_Name () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

Configuration

KSP Version: 1.7.0
kRPC Version: 0.4.8
KSP Mods:

  • EVE
  • DistantObjectEnhancements
  • KerbalJointReinforcement
  • Kopernicus
  • MechJeb2
  • ModularFlightIntegrator
  • PlanetShine
  • Scatterer
  • Telemachus
  • TriggerTech
  • ModuleManager (3.0.7 and 4.0.2)
commented

fixed here: #530