why i can't read sda1 with python?

Corey Richardson corey at octayn.net
Mon Jun 4 04:08:56 EDT 2012


On Sat, 2 Jun 2012 10:14:36 +0800
"水静流深" <1248283536 at qq.com> <1248283536 at qq.com> wrote:

> [snip]
> i want to read  sda1  with python:
> >>> file=open('/dev/sda1','rb')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IOError: [Errno 13] Permission denied: '/dev/sda1'
> 
> how can i own the access to read sda1?
>

You need read privileges. Either change the permissions of /dev/sda1,
or run python as root.

-- 
Corey Richardson



More information about the Python-list mailing list