Dave Benjamin wrote:
> Here's the problem: the "mmap" object doesn't have a reference to
> "somefile", only to its file descriptor number. So, when getfile() goes
> out of scope, there are no references left, and the file gets closed
> automatically.
That makes a lot of sense. It's now how I woul
bens wrote:
> I'm trying to return an 'mmap' object from a function. The return
> works, but some of the object's methods crash. Here are two examples
>
> doesntwork.py
> ---
> import mmap
> import os
>
> name="/any/real/file/on/my/hard/drive"
>
> def getfile(name):
>
bens wrote:
> I'm trying to return an 'mmap' object from a function. The return
> works, but some of the object's methods crash. Here are two examples
>
> doesntwork.py
> ---
> import mmap
> import os
>
> name="/any/real/file/on/my/hard/drive"
>
> def getfile(name):
>
I'm trying to return an 'mmap' object from a function. The return
works, but some of the object's methods crash. Here are two examples
doesntwork.py
---
import mmap
import os
name="/any/real/file/on/my/hard/drive"
def getfile(name):
somefile=file(name, 'r+b')
mm