I am trying to make a console program using the pywin32 module
My code is:
import win32con, win32console, time, random
MyCon = win32console.CreateConsoleScreenBuffer(DesiredAccess = win32con.GENERIC_READ | win32con.GENERIC_WRITE, ShareMode = 0, SecurityAttributes = None, Flags = 1)
MyCon.SetConsoleActiveScreenBuffer()
rect = win32console.PySMALL_RECTType(20, 30, 600, 600)
MyCon.SetConsoleWindowInfo(Absolute = False, ConsoleWindow = rect)
while True:
y = str(random.randint(1,100)) + ' '
MyCon.WriteConsoleOutputCharacter(Characters = y, WriteCoord = win32console.PyCOORDType(5,6))
time.sleep(0.1)
This is the error i am facing when i am trying to run the program from cmd.exe

I am giving the parameters as said in the docs here http://timgolden.me.uk/pywin32-docs/PyConsoleScreenBuffer__SetConsoleWindowInfo_meth.html
How to fix this ?