On 3/7/07, Christian Theune <[EMAIL PROTECTED]> wrote:
This is how the dance looks like to do the link():

 >>> import tempfile, os
 >>> d = tempfile.NamedTemporaryFile()
 >>> os.path.exists(d.name)
 True
 >>> d.write('Test')
 >>> os.path.exists('/tmp/asdf')
 False
 >>> os.link(d.name, '/tmp/asdf')
 >>> d.close()
 >>> os.path.exists(d.name)
 False
 >>> os.path.exists('/tmp/asdf')
 True
 >>> open('/tmp/asdf').read()
 'Test'


Ok, this is how it looks on Windows. :)

import os
import win32file
f = open('test.txt', 'wb')
f.write('hello world')
f.close()
win32file.CreateHardLink('hello.txt', 'test.txt')
os.listdir(os.getcwd())
['hello.txt', 'test.txt']
f = open('hello.txt', 'wb')
f.write('hello there')
f.close()
print open('hello.txt').read()
hello there
print open('test.txt').read()
hello there
os.remove('test.txt')
print open('hello.txt').read()
hello there
print open('test.txt').read()
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: 'test.txt'

--
Sidnei da Silva
Enfold Systems                http://enfoldsystems.com
Fax +1 832 201 8856     Office +1 713 942 2377 Ext 214
_______________________________________________
Zope3-dev mailing list
[email protected]
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to