Python error on pyautogui

Traceback (most recent call last):
File “C:\Users\hemil\Downloads\fun-clicker-bot-text-1.py”, line 24, in
pg.typewrite(randSeed)
File “C:\Users\hemil\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui_init_.py”, line 586, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File “C:\Users\hemil\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui_init_.py”, line 1665, in typewrite
for c in message:
TypeError: ‘int’ object is not iterable

i was trying to do this

import random as rand

randSeed = rand.randint(1,20)
pg.typewrite(randSeed)

This is just a wild guess, as I have never used pyautogui, but try this:

pg.typewrite(str(randSeed))

The random.randint function returns an integer, for example 15. But pyautogui.typewrite expects a string, and emulates the corresponding key presses. The integer 15 is an object you can do arithmetic on. The string "15" is different: it is a sequence containing the characters 1 and 5. For instance:

>>> 15 + 16
31
>>> "15" + "16"
'1516'

You probably want to convert your integer into a string first using:

pyautogui.typewrite(str(random.randint(1, 20)))

how to mark something as a solution?
Im just :sparkles:curious :sparkles: