Skip to content

上 200 个密钥: #5098

@188950180-gif

Description

@188950180-gif

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

上 200 个密钥:
 , Space h o s t = " 0 . 0 . 0 . 0 " , Space p o r t = 8 0 0 0 , Space r e l o a d = T r u e ) Enter
 ' ' ' Enter
 Enter
 w i t h Space o p e n ( o s . p a t h . j o i n ( b a s e _ d i r , Space " a p p / m a i n . p y " ) , Space " w " , Space e n c o d i n g = " u t f - 8 " ) Space a s Space f : Enter
 Space Space Space Space f . w r i t e ( m a i n _ p y ) Enter
 p r i n t ( " ? Space m a i n . p y Space 创 建 完 成 " ) Enter
 Enter
 p r i n t ( " \ \ n 所 有 A P I 文 件 创 建 完 成 ! " ) Enter
 E O F Enter


异常:
System.ArgumentOutOfRangeException: 该值必须大于或等于零,且必须小于控制台缓冲
区在该维度的大小。
参数名: top
实际值是 -98。
   在 System.Console.SetCursorPosition(Int32 left, Int32 top)
   在 Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   在 Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   在 Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate) 
   在 Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   在 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   在 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Screenshot

上 200 个密钥:
, Space h o s t = " 0 . 0 . 0 . 0 " , Space p o r t = 8 0 0 0 , Space r e l o a d = T r u e ) Enter
' ' ' Enter
Enter
w i t h Space o p e n ( o s . p a t h . j o i n ( b a s e _ d i r , Space " a p p / m a i n . p y " ) , Space " w " , Space e n c o d i n g = " u t f - 8 " ) Space a s Space f : Enter
Space Space Space Space f . w r i t e ( m a i n _ p y ) Enter
p r i n t ( " ? Space m a i n . p y Space 创 建 完 成 " ) Enter
Enter
p r i n t ( " \ \ n 所 有 A P I 文 件 创 建 完 成 ! " ) Enter
E O F Enter

异常:
System.ArgumentOutOfRangeException: 该值必须大于或等于零,且必须小于控制台缓冲
区在该维度的大小。
参数名: top
实际值是 -98。
在 System.Console.SetCursorPosition(Int32 left, Int32 top)
在 Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
在 Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
在 Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
在 Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
在 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
在 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Environment data

main_py : 无法将“main_py”项识别为 cmdlet、函数、脚本文件或可运行程序的名称    
。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ main_py = '''from fastapi import FastAPI
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (main_py:String) [], CommandNo  
   tFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
(.venv) PS H:\2026\SHZ01> with open(os.path.join(base_dir, "app/main.py"), "w", encoding="utf-8") as f:
所在位置 行:1 字符: 32
+ with open(os.path.join(base_dir, "app/main.py"), "w", encoding="utf-8 ...   
+                                ~
参数列表中缺少参量。
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecord  
   Exception
    + FullyQualifiedErrorId : MissingArgument
(.venv) PS H:\2026\SHZ01>     f.write(main_py)
所在位置 行:1 字符: 13
+             ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (main_py:String) [], CommandNo  
   tFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
(.venv) PS H:\2026\SHZ01> print("? main.py 创建完成")
无法初始化设备 PRN
(.venv) PS H:\2026\SHZ01> 
(.venv) PS H:\2026\SHZ01> print("\\n所有API文件创建完成!")
无法初始化设备 PRN
(.venv) PS H:\2026\SHZ01> EOF
EOF : 无法将“EOF”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查      
名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ EOF
+ ~~~
    + CategoryInfo          : ObjectNotFound: (EOF:String) [], CommandNotFou    
   ndException
    + FullyQualifiedErrorId : CommandNotFoundException

Steps to reproduce

(.venv) PS H:\2026\SHZ01> # 4. 创建 main.py
(.venv) PS H:\2026\SHZ01> main_py = '''from fastapi import FastAPI

from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager

from app.core.database import sync_engine, Base
from app.api import auth, alert

@asynccontextmanager
async def lifespan(app: FastAPI):
Base.metadata.create_all(bind=sync_engine)
yield

app = FastAPI(
title="守望者API",
description="独居老人/危重人群生命守护系统",
version="1.0.0",
lifespan=lifespan
)

app.add_middleware(
CORSMiddleware,
allow_origins=[""],
allow_credentials=True,
allow_methods=["
"],
allow_headers=["*"],
)

app.include_router(auth.router, prefix="/api/v1/auth", tags=["认证"])
app.include_router(alert.router, prefix="/api/v1/alerts", tags=["警报"])

Expected behavior

main_py : 无法将“main_py”项识别为 cmdlet、函数、脚本文件或可运行程序的名称
。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • main_py = '''from fastapi import FastAPI
  •   + CategoryInfo          : ObjectNotFound: (main_py:String) [], CommandNo  
     tFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

(.venv) PS H:\2026\SHZ01> with open(os.path.join(base_dir, "app/main.py"), "w", encoding="utf-8") as f:
所在位置 行:1 字符: 32

  • with open(os.path.join(base_dir, "app/main.py"), "w", encoding="utf-8 ...
  •                            ~
    

参数列表中缺少参量。
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecord
Exception
+ FullyQualifiedErrorId : MissingArgument
(.venv) PS H:\2026\SHZ01> f.write(main_py)
所在位置 行:1 字符: 13

  •         ~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (main_py:String) [], CommandNo
      tFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

(.venv) PS H:\2026\SHZ01> print("? main.py 创建完成")
无法初始化设备 PRN
(.venv) PS H:\2026\SHZ01>
(.venv) PS H:\2026\SHZ01> print("\n所有API文件创建完成!")
无法初始化设备 PRN
(.venv) PS H:\2026\SHZ01> EOF
EOF : 无法将“EOF”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查
名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1

  • EOF
  •   + CategoryInfo          : ObjectNotFound: (EOF:String) [], CommandNotFou    
     ndException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

Actual behavior

(.venv) PS H:\2026\SHZ01> # 4. 创建 main.py
(.venv) PS H:\2026\SHZ01> main_py = '''from fastapi import FastAPI

from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager

from app.core.database import sync_engine, Base
from app.api import auth, alert

@asynccontextmanager
async def lifespan(app: FastAPI):
Base.metadata.create_all(bind=sync_engine)
yield

app = FastAPI(
title="守望者API",
description="独居老人/危重人群生命守护系统",
version="1.0.0",
lifespan=lifespan
)

app.add_middleware(
CORSMiddleware,
allow_origins=[""],
allow_credentials=True,
allow_methods=["
"],
allow_headers=["*"],
)

app.include_router(auth.router, prefix="/api/v1/auth", tags=["认证"])
app.include_router(alert.router, prefix="/api/v1/alerts", tags=["警报"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions