0

In python (IDLE) itself, I know if I type dir(list), I get a list of the properties of list as seen below:

>>> dir(list)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

However, my question is, how do I do that in a .py file? If I type in print(dir(list)), I get the following error on my localhost

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/http/server.py", line 1031, in run_cgi
os.execve(scriptfile, args, os.environ)
OSError: [Errno 13] Permission denied

Suggestions?

A. Rodas
  • 20,171
  • 8
  • 62
  • 72
Student J
  • 203
  • 1
  • 5
  • 13

1 Answers1

0

It looks like your script does not have execution permission. Try with chmod +x server.py and then run the script again.

A. Rodas
  • 20,171
  • 8
  • 62
  • 72
  • Where do I enter this? In my cgi-bin directory? – Student J Jun 23 '13 at 17:34
  • @user1631819 No, with your terminal. If you want to use the absolute path, simply write `chmod +x /Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/http/server.py`. – A. Rodas Jun 23 '13 at 17:37
  • I got this message: `chmod: Unable to change file mode on /Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/http/server.py: Operation not permitted` – Student J Jun 23 '13 at 17:45