mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-03-18 12:40:06 +08:00
fix: getuid not found in windows
This commit is contained in:
@@ -99,7 +99,11 @@ IMPORTANT SAFETY GUIDELINES:
|
|||||||
logger.debug(f"[Bash] OPENAI_API_KEY in env: {'OPENAI_API_KEY' in env}")
|
logger.debug(f"[Bash] OPENAI_API_KEY in env: {'OPENAI_API_KEY' in env}")
|
||||||
logger.debug(f"[Bash] SHELL: {env.get('SHELL', 'not set')}")
|
logger.debug(f"[Bash] SHELL: {env.get('SHELL', 'not set')}")
|
||||||
logger.debug(f"[Bash] Python executable: {sys.executable}")
|
logger.debug(f"[Bash] Python executable: {sys.executable}")
|
||||||
logger.debug(f"[Bash] Process UID: {os.getuid()}")
|
# getuid() only exists on Unix-like systems
|
||||||
|
if hasattr(os, 'getuid'):
|
||||||
|
logger.debug(f"[Bash] Process UID: {os.getuid()}")
|
||||||
|
else:
|
||||||
|
logger.debug(f"[Bash] Process User: {os.environ.get('USERNAME', os.environ.get('USER', 'unknown'))}")
|
||||||
|
|
||||||
# Execute command with inherited environment variables
|
# Execute command with inherited environment variables
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
|
|||||||
@@ -245,9 +245,9 @@ class Config(dict):
|
|||||||
self.user_datas = pickle.load(f)
|
self.user_datas = pickle.load(f)
|
||||||
logger.debug("[Config] User datas loaded.")
|
logger.debug("[Config] User datas loaded.")
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
logger.info("[Config] User datas file not found, ignore.")
|
logger.debug("[Config] User datas file not found, ignore.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info("[Config] User datas error: {}".format(e))
|
logger.warning("[Config] User datas error: {}".format(e))
|
||||||
self.user_datas = {}
|
self.user_datas = {}
|
||||||
|
|
||||||
def save_user_datas(self):
|
def save_user_datas(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user