Re: Why doesn't os.remove work on directories?

2015-12-24 Thread Laurent Delacroix
On 23/12/15 05:29, Random832 wrote:
> 
> This is surprising to anyone accustomed to the POSIX C remove
> function, which can remove either files or directories.  Is there
> any known rationale for this decision?
> 

Hello, in POSIX C the remove() function is actually rmdir() when called
on a directory: http://bit.ly/1NE1rfZ

I'm not sure about the rationale behind raising OSError if the argument
is a directory though. Maybe the "There should be one-- and preferably
only one --obvious way to do it." philosophy explains it. :-)

Lau
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: CGI

2015-12-27 Thread Laurent Delacroix
On 26/12/15 10:41, Pol Hallen wrote:
> 
> How can I execute a local command (like ls or similar) and show output 
> via browser?
> 

Either you use a proper web framework (Flask, Bottle, Django in order of
complexity) or you set up a web server with FastCGI support (e.g. nginx)
and run a WSGI application behind it.

Useful link:
https://docs.python.org/2/howto/webservers.html#setting-up-fastcgi

Lau
-- 
https://mail.python.org/mailman/listinfo/python-list