Skip to content

Getting 'LightningStart' keyvalue (after setting it) throws UnicodeDecodeError #253

@damianzgo7

Description

@damianzgo7

SP Info:

--------------------------------------------------------
Checksum      : 3184d5e4de2344ee5d3cd92992f642de
Date          : 2018-07-22 15:48:07.484783
OS            : Windows-7-6.1.7601-SP1
Game          : css
SP version    : 656
Github commit : 9278f6c239e09403cf6fe5d3410ae565f936d284
Server plugins:
   00: Source.Python, (C) 2012-2018, Source.Python Team.
SP plugins:
   00: test
--------------------------------------------------------

Code to reproduce error:

# ../test/test.py

from entities.entity import Entity
from commands.typed import TypedSayCommand

@TypedSayCommand("/test")
def test(command_info):
    beam = Entity.create("env_beam")
    beam.set_key_value_string("targetname", f"test1_{command_info.index}")
    print(beam.get_key_value_string("targetname"))
    beam.set_key_value_string("LightningStart", f"test2_{command_info.index}")
    print(beam.get_key_value_string("LightningStart"))

Console output:

] say /test
test1_1

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\packages\source-python\commands\auth.py", line 44, in __call__
    return self.callback(*args)
  File "..\addons\source-python\packages\source-python\commands\typed.py", line 554, in on_command
    result = cls.on_clean_command(command_info, command_node, args)
  File "..\addons\source-python\packages\source-python\commands\typed.py", line 612, in on_clean_command
    return super().on_clean_command(command_info, command_node, args)
  File "..\addons\source-python\packages\source-python\commands\typed.py", line 569, in on_clean_command
    return command_node.callback(command_info, *cleaned_args)
  File "..\addons\source-python\plugins\test\test.py", line 12, in test
    print(beam.get_key_value_string("LightningStart"))

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 1: invalid start byte

This error can be reproduced by modifying other string keyvalues like "LightningEnd" as well.
This is weird, because "targetname" don't throw this error (as seen in console output). Also, "targetname" and "LightningStart" keyvalues types should be the same (string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions