mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: nest msvcrt import inside fcntl except block
Match cron/scheduler.py pattern — only attempt msvcrt import when fcntl is unavailable. Pre-declare msvcrt = None at module level so _file_lock() references don't NameError on Linux.
This commit is contained in:
parent
420d27098f
commit
5f36b42b2e
1 changed files with 6 additions and 5 deletions
|
|
@ -33,15 +33,16 @@ from pathlib import Path
|
||||||
from hermes_constants import get_hermes_home
|
from hermes_constants import get_hermes_home
|
||||||
from typing import Dict, Any, List, Optional
|
from typing import Dict, Any, List, Optional
|
||||||
|
|
||||||
|
# fcntl is Unix-only; on Windows use msvcrt for file locking
|
||||||
|
msvcrt = None
|
||||||
try:
|
try:
|
||||||
import fcntl
|
import fcntl
|
||||||
except ImportError:
|
except ImportError:
|
||||||
fcntl = None
|
fcntl = None
|
||||||
|
try:
|
||||||
try:
|
import msvcrt
|
||||||
import msvcrt
|
except ImportError:
|
||||||
except ImportError:
|
pass
|
||||||
msvcrt = None
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue