[Numpy-discussion] Question about memmap

Gökhan SEVER gokhansever at gmail.com
Wed Jun 10 02:51:19 EDT 2009


On Wed, Jun 10, 2009 at 12:34 AM, Matthew Brett <matthew.brett at gmail.com>wrote:

> Hi,
>
> > I am having problem while trying to memory map a simple file (attached as
> > test.txt)
>
> The file looks like a text file, but memmap is for binary files.
> Could that be the problem?
>
> Best,
>
> Matthew


What's the reason again that memmap only works with binary files? Could the
functionality be extended to text files as well?

Python's mmap module support text file mapping, however I am getting another
error this time :(

In [1]: import mmap

In [2]: f = open('test.txt', 'r')

In [3]: map = mmap.mmap(f.fileno(), 0)
---------------------------------------------------------------------------
EnvironmentError                          Traceback (most recent call last)

/home/gsever/Desktop/src/range_calc/<ipython console> in <module>()

EnvironmentError: [Errno 13] Permission denied


I am on a Linux machine...

gs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090610/c024706f/attachment.html>


More information about the NumPy-Discussion mailing list