This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Problem with tapedevices and the tarfile module
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: esshenrik, lars.gustaebel, loewis
Priority: normal Keywords:

Created on 2005-11-21 07:44 by esshenrik, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg26908 - (view) Author: Henrik (esshenrik) Date: 2005-11-21 07:44
Problem to read a archive from tape that was created 
with the tarfile module in python.

Error:
>>> tar = tarfile.open("/dev/st0", "r")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.4/tarfile.py", line 
916, in open
    return func(name, "r", fileobj)
  File "/usr/local/lib/python2.4/tarfile.py", line 
933, in taropen
    return cls(name, mode, fileobj)
  File "/usr/local/lib/python2.4/tarfile.py", line 
811, in __init__
    fileobj = file(self.name, self.mode)
IOError: [Errno 16] Device or resource 
busy: '/dev/st0'


I was creating the archive with succes:
>>> tar.close()
>>> tar = tarfile.open("/dev/st0", "w")
>>> tar.add("/tmp/bin1.tar")
>>> tar.add("/tmp/bin2.tar")
>>> tar.close()
>>>

When I try to read the tape without pyton the 
folowing error:
[root@localhost tmp]# tar tvbf 20 /dev/st0
tar: Record size = 8 blocks
-rw-r--r-- root/root 128614400 2005-11-20 19:53:11 
tmp/bin1.tar
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
tar: /dev/st0: Cannot read: Cannot allocate memory
......

Can anyone help me with this problem or have another 
module for tarfile that works with tapedevices?

/Henrik 
msg26909 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2005-11-21 08:40
Logged In: YES 
user_id=642936

Could try and use tarfile's stream interface for writing and
reading and see if that works? Just append a pipe symbol to
the mode, e.g.:

tar = tarfile.open("/dev/st0", "w|")
msg26910 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-03 12:31
Logged In: YES 
user_id=21627

Lowering priority, as the issue doesn't appear that urgent.
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42615
2005-11-21 07:44:06esshenrikcreate