Here: 'C:\Users\tom\Desktop\PythonScripts\charList.txt'
. That's a file name, not a directory name.
Try without charList.txt
:
os.listdir('C:\\Users\\tom\\Desktop\\PythonScripts')
Any particular reason why you're appending the filename to a listdir
operation?