避免文件损坏 [英] avoiding file corruption
问题描述
试图打开一个已经开放写作的文件
会导致异常。
很容易意外地打开搁置两次写入和
这可能导致难以追踪数据库损坏错误。
Amir
Hi,
Trying to open a file for writing that is already open for writing
should result in an exception.
It''s all too easy to accidentally open a shelve for writing twice and
this can lead to hard to track down database corruption errors.
Amir
推荐答案
2006年8月27日00:44:33 -0700,Amir Michail< am **** **@gmail.com>:
27 Aug 2006 00:44:33 -0700, Amir Michail <am******@gmail.com>:
尝试打开已写入的文件写作
应该会导致异常。
很容易意外地打开书架两次写作
这可能导致难以追踪数据库损坏错误。
Amir
-
http://mail.python.org/mailman/listinfo/python-list
即使它可能很奇怪,操作系统通常允许你打开一个文件
两次,这取决于程序员确保
操作的一致性。
PAolo
-
如果您有一分钟的时间可以访问我的photogrphy网站:
http:// mypic .co.nr
Paolo Pantaleo写道:
Paolo Pantaleo wrote:
2006年8月27日00:44:33 -0700,Amir Michail< am ****** @ gmail.com>:
27 Aug 2006 00:44:33 -0700, Amir Michail <am******@gmail.com>:
试图打开一个已经开放写作的文件
应该会导致异常。
它'很容易意外地打开搁置两次写入和/或
这可能导致难以追踪数据库损坏错误。
Amir
-
http://mail.python.org/ mailman / listinfo / python-list
即使它可能很奇怪,操作系统通常允许你打开一个文件
两次,由程序员来确保
操作的一致性。
PAolo
Even if it could be strange, the OS usually allow you to open a file
twice, that''s up to the programmer to ensure the consistency of the
operations.
PAolo
但是如果这通常是一个严重的错误,那么不应该例外吗?
Amir
But if this is usually a serious bug, shouldn''t an exception be raised?
Amir
> ;
-
如果你有一分钟的时间可以访问我的photogrphy网站:
http://mypic.co.nr
Amir Michail schrieb:
Amir Michail schrieb:
Paolo Pantaleo写道:
Paolo Pantaleo wrote:
> 2006年8月27日00:44:33 -0700,Amir Michail< ;是****** @ gmail的.com>:
>27 Aug 2006 00:44:33 -0700, Amir Michail <am******@gmail.com>:
>>
试图打开一个已经开放写作的文件
应该导致异常。
很容易意外地打开搁置两次写入,这可能导致难以追踪数据库损坏错误。
Amir
http://mail.python.org/mailman/listinfo/python-list
即使它可能很奇怪,操作系统通常会允许你打开一个文件
两次,这取决于程序员确保
操作的一致性。
PAolo
Even if it could be strange, the OS usually allow you to open a file
twice, that''s up to the programmer to ensure the consistency of the
operations.
PAolo
但如果这通常是一个严重的错误,那么不应该提出异常吗?
But if this is usually a serious bug, shouldn''t an exception be raised?
执行" rm -rf /"通过子进程通常也是一个坏主意。所以?否
语言可以防止你犯这样的错误。如果文件被打开两次,则无法知道
- 可能是您打开同一个文件
两次,例如网络共享。没办法知道它是同一个文件。
Diez
executing "rm -rf /" via subprocess is usually also a bad idea. So? No
language can prevent you from doing such mistake. And there is no way to
know if a file is opened twice - it might that you open the same file
twice via e.g. a network share. No way to know that it is the same file.
Diez
这篇关于避免文件损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!