PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.77k stars 298 forks source link

python script using os.stat or os.path.getsize generates a system exception #4247

Closed ryoungs closed 3 weeks ago

ryoungs commented 3 weeks ago

Prerequisites

Exception report

-----------------------------------------------------------------------
Last 124 Keys:
 & Space " C : / P r o g r a m Space F i l e s / P y t h o n 3 1 2 / p y t h o n . e x e " Space " c : / U s e r s / R a l p h / D e s k t o p / P y P r o j e c t s / 0 1 Space T C R Space p r o j e c t s Space & Space e x a m p l e s / P N Y T s / f i l e _ s i z e . p y " Enter

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Screenshot

see vscode terminal output above

Environment data

unknown

Steps to reproduce

python: rs = os.path.getsize('Spearmint.jpeg') print(f"file size: {rs}")

Expected behavior

accurate size of file

Actual behavior

system excpetion message then file size: 18103

github-actions[bot] commented 3 weeks ago

This issue was already fixed (see #1306). Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.