Skip to content

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

@ryoungs

Description

@ryoungs

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

-----------------------------------------------------------------------
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

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