On 2016-04-30 11:51, 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'])
It works on my system: Ubuntu 14.04LTS

(venv)alex@X301:~$ python
Python 3.4.3 (default, Oct 14 2015, 20:33:09)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
import subprocess
ls_output= subprocess.check_output(['dir'])
ls_output
b'Airbnb\tBookSite CURRENT Documents examples.desktop\tJs\t nextWIFI\t OpenWRT Py\t Solar ToDo\t WARNING\nARM\tC\t debk\t double gnupg.other\tLEFTOFF node_modules Pathagar Rachel Templates toDoAtLoft wishes\nAVR\tclosures Desktop Downloads GPL\t\tLibreboot Notes\t Pictures Sask Test Videos\t WWW\nbin\tContacts Docbook Encrypted HTML5\t\tMusic\t OLPC\t\t Public ski\t tmp\t vim_rewrap\n'
exit()
(venv)alex@X301:~$ dir
Airbnb BookSite CURRENT Documents examples.desktop Js nextWIFI OpenWRT Py Solar ToDo WARNING ARM C debk double gnupg.other LEFTOFF node_modules Pathagar Rachel Templates toDoAtLoft wishes AVR closures Desktop Downloads GPL Libreboot Notes Pictures Sask Test Videos WWW bin Contacts Docbook Encrypted HTML5 Music OLPC Public ski tmp vim_rewrap
(venv)alex@X301:~$ man dir


Perhaps you are using a linux command on a non linux (?Windows) system.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to