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

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

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

Postby decompile » Sat Jun 03, 2017 12:47 pm

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'}}}
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Sat Jun 03, 2017 3:00 pm

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
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

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

Postby decompile » Sat Jun 03, 2017 3:15 pm

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?
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Sat Jun 03, 2017 4:07 pm

Why do you think I changed it? I just copied the code.

Though, using CS:GO I'm able to reproduce the issue.
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

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

Postby decompile » Sat Jun 03, 2017 8:05 pm

Ye, forgot that im using CS:GO.

(My bad, I forgot that dicts are random)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 40 guests