Skip to content

Commit 4ea9e3c

Browse files
committed
fix(main): NoSectionError on generating cfg
1 parent 35f99c0 commit 4ea9e3c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "nekobox"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "A Satori backend powered by lagrange-python"
55
authors = [
66
{name = "wyapx", email = "[email protected]"},

src/nekobox/__main__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import configparser
12
import shutil
23
import asyncio
34
import secrets
@@ -71,7 +72,11 @@ def set_cfg(
7172
i = default
7273
if i and unique and i not in unique:
7374
raise ValueError
75+
76+
if not cfg.has_section(section):
77+
cfg.add_section(section)
7478
cfg.set(section, option, i)
79+
7580
return i
7681
except (TypeError, ValueError):
7782
print(f">>> 输入不符合约束: {green}{unique}{reset}")

0 commit comments

Comments
 (0)