[Tutor] "List" object is not callable

Steven D'Aprano steve at pearwood.info
Sat Apr 30 23:11:45 EDT 2016


On Sat, Apr 30, 2016 at 06:51:17PM +0000, Jason N. via Tutor wrote:
> Hello,
> I found this simple script online but when I execute it I get the 
> following error: "TypeError: 'list' object is not callable" Here is 
> the code sample:
>
> import subprocess
> ls_output= subprocess.check_output(['dir'])

The code snippet works fine.

Please check that the code you send is exactly the same as the code you 
are actually trying to run. Do not just retype the code from memory, 
copy and paste it.

Also, please copy and paste the full traceback that you get, not just 
the final error message. Everything from the first "Traceback" line to 
the end.

Finally, you should tell us what version of Python you are running, on 
what operating system (Linux, Mac OS, Windows XP, Windows 10, Android, 
something else), and whether you are using the standard Python 
interactive interpreter or something else (IDLE, iPython, Anaconda, 
PyCharm, etc.).


-- 
Steve


More information about the Tutor mailing list