Python error on pyautogui

Traceback (most recent call last):
File “C:\Users\hemil\Downloads\”, line 24, in
File “C:\Users\hemil\AppData\Local\Programs\Python\Python39\lib\site-packages\”, line 586, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File “C:\Users\hemil\AppData\Local\Programs\Python\Python39\lib\site-packages\”, 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)

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


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
>>> "15" + "16"

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: