Page 1 of 1

KeyValues 'Default' changes to 'default' in .as_dict()

Posted: Sat Jun 03, 2017 12:47 pm
by decompile
Hey,

Im currently doing some KeyValues stuff, and I noticed when I add 'Default' in the files, it gets printed as 'default' (Small letters).

Syntax: Select all

from paths import GAME_PATH
from keyvalues import KeyValues

PATH = GAME_PATH / 'test.txt'

keyvalues = KeyValues.load_from_file(PATH)

print(keyvalues.as_dict())


Code: Select all

"Test"
{
   "Test 1"
   {
      "Test 1 1"
      {
         "test"   "test"
      }
   }
   "Default"
   {
      "Test 2 2"
      {
         "test"   "test"
      }
   }
}


Code: Select all

{'Test 1': {'Test 1 1': {'Test': 'test'}}, 'default': {'Test 2 2': {'Test': 'test'}}}

Re: KeyValues 'Default' changes to 'default' in .as_dict()

Posted: Sat Jun 03, 2017 3:00 pm
by Ayuto
Works fine for me.

Code: Select all

{'Default': {'Test 2 2': {'Test': 'test'}}, 'Test 1': {'Test 1 1': {'Test': 'test'}}}


Code: Select all

sp info

Date          : 2017-06-03 14:59:39.906326
OS            : Windows-7-6.1.7601-SP1
Game          : css
SP version    : unversioned
Server plugins:
   00: Source.Python, (C) 2012-2016, Source.Python Team.
SP plugins:
   00: test3

Re: KeyValues 'Default' changes to 'default' in .as_dict()

Posted: Sat Jun 03, 2017 3:15 pm
by decompile

Code: Select all

Date          : 2017-06-03 15:13:42.241723
OS            : Windows-10-10.0.15063
Game          : csgo
SP version    : 581


Hmm,

But you did change the txt file, can you try to replicate it as its on the thread?

Re: KeyValues 'Default' changes to 'default' in .as_dict()

Posted: Sat Jun 03, 2017 4:07 pm
by Ayuto
Why do you think I changed it? I just copied the code.

Though, using CS:GO I'm able to reproduce the issue.

Re: KeyValues 'Default' changes to 'default' in .as_dict()

Posted: Sat Jun 03, 2017 8:05 pm
by decompile
Ye, forgot that im using CS:GO.

(My bad, I forgot that dicts are random)