https://github.com/tuokri/udk_configparser
Config parser for UDK .ini files.
https://github.com/tuokri/udk_configparser
config configparser ini ini-parser udk ue3
Last synced: 11 months ago
JSON representation
Config parser for UDK .ini files.
- Host: GitHub
- URL: https://github.com/tuokri/udk_configparser
- Owner: tuokri
- License: mit
- Created: 2020-04-08T09:49:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-08T13:51:19.000Z (over 2 years ago)
- Last Synced: 2025-03-04T10:48:56.457Z (12 months ago)
- Topics: config, configparser, ini, ini-parser, udk, ue3
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# udk_configparser
Like CPython standard configparser but adjusted for UDK config files.
## Installation
```shell
pip install udk_configparser
```
## Example usage
### Setting a single value
```python
from udk_configparser import UDKConfigParser
cg = UDKConfigParser()
cg.read("Engine.ini")
cg["Section"]["Key"] = "NewValue"
```
### Setting a multi-value field and writing the file
```python
# Multi-value example.
pkg_name = "MyPackage"
edit_packages = cg["UnrealEd.EditorEngine"].getlist("+EditPackages")
if pkg_name not in edit_packages:
edit_packages.append(pkg_name)
# Currently, setting multi-value data requires manually
# joining the data to ensure it is written correctly.
cg["UnrealEd.EditorEngine"]["+EditPackages"] = "\n".join(edit_packages)
with open("Engine.ini", "w") as config_file:
cg.write(config_file, space_around_delimiters=False)
# Engine.ini before writing:
# [UnrealEd.EditorEngine]
# +EditPackages=UTGame
# +EditPackages=UTGameContent
# After:
# [UnrealEd.EditorEngine]
# +EditPackages=UTGame
# +EditPackages=UTGameContent
# +EditPackages=MyPackage
```
## Known issues
- Comments get removed during writes.