Does ftruncate work?

Paul Winkler bass at slinkp.com
Wed Jan 9 14:59:32 EST 2002


Can somebody tell me what's wrong here?

[pw at slink pw]$ touch foo
[pw at slink pw]$ python
Python 2.1.1+ (#1, Jan  8 2002, 00:37:12) 
[GCC 2.95.4 20011006 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.ftruncate.__doc__
ftruncate(fd, length) -> None
Truncate a file to a specified length.
>>> f = open('foo', 'rw')
>>> os.ftruncate(f, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: an integer is required

--

Paul Winkler



More information about the Python-list mailing list