accessing parts of large files with File.seek()

  • Thread starter mhearne808[insert-at-sign-here]gmail[insert-dot-he
  • Start date
M

mhearne808[insert-at-sign-here]gmail[insert-dot-he

I'm having a problem with the File object's seek() method.
Specifically, I cannot use it to seek to a location in a binary file
that is greater than 2^31 (2147483648). This seems unnecessarily
limiting, as it is common these days to have files larger than 2 GB.

Is there some LargeFile object out there that I can use to read my
file, which is approximately 3.3 GB in size?

Python version (freshly built from source this morning):
Python 2.5.1 (r251:54863, Aug 8 2007, 09:23:05)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

Thanks,

Mike
 
P

programmer.py

I'm having a problem with the File object's seek() method.
Specifically, I cannot use it to seek to a location in a binary file
that is greater than 2^31 (2147483648). This seems unnecessarily
limiting, as it is common these days to have files larger than 2 GB.

Is there some LargeFile object out there that I can use to read my
file, which is approximately 3.3 GB in size?

Python version (freshly built from source this morning):
Python 2.5.1 (r251:54863, Aug 8 2007, 09:23:05)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

Thanks,

Mike

I use large files quite a bit, but in Windows & Linux. Here's a quick
excerpt of a local ubuntu-linux session...

jaime@elizabeth:/var/virtualbox/VDI$ ls -l
total 1682536
-rw-rwx--- 1 jaime vboxusers 40960 2007-07-20 21:41 windows
xp.vdi
-rw-rwx--- 1 jaime vboxusers 3591387136 2007-07-20 21:53 winxp.vdi
jaime@elizabeth:/var/virtualbox/VDI$ ipython
Python 2.5.1 (r251:54863, May 2 2007, 16:27:44)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.3 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: f = file('winxp.vdi')

In [2]: f.seek(3591387132)

In [3]: f.read()
Out[3]: '\x00\x00\x00\x00'

In [4]:

What exception are you receiving? (Not that I can offer any advice,
as I don't have a Mac to use for testing.)...

jw
 
M

mhearne808[insert-at-sign-here]gmail[insert-dot-he

I'm having a problem with the File object's seek() method.
Specifically, I cannot use it to seek to a location in a binary file
that is greater than 2^31 (2147483648). This seems unnecessarily
limiting, as it is common these days to have files larger than 2 GB.
Is there some LargeFile object out there that I can use to read my
file, which is approximately 3.3 GB in size?
Python version (freshly built from source this morning):
Python 2.5.1 (r251:54863, Aug 8 2007, 09:23:05)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

Mike

I use large files quite a bit, but in Windows & Linux. Here's a quick
excerpt of a local ubuntu-linux session...

jaime@elizabeth:/var/virtualbox/VDI$ ls -l
total 1682536
-rw-rwx--- 1 jaime vboxusers 40960 2007-07-20 21:41 windows
xp.vdi
-rw-rwx--- 1 jaime vboxusers 3591387136 2007-07-20 21:53 winxp.vdi
jaime@elizabeth:/var/virtualbox/VDI$ ipython
Python 2.5.1 (r251:54863, May 2 2007, 16:27:44)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.3 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: f = file('winxp.vdi')

In [2]: f.seek(3591387132)

In [3]: f.read()
Out[3]: '\x00\x00\x00\x00'

In [4]:

What exception are you receiving? (Not that I can offer any advice,
as I don't have a Mac to use for testing.)...

jw

I think I've figured out what the problem must be (not at Mac anymore,
so will have to test tomorrow). According to this link:
http://docs.python.org/lib/posix-large-files.html

I probably need to compile in large file support on my Mac. I get it
for free on my Ubuntu linux box...

FYI, it was an OverFlow Error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top