[Tutor] tarfile +stdin

wesley chun wescpy at gmail.com
Wed Dec 20 04:34:59 CET 2006


>  >>> tbz.add(sys.stdin)
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>                  :
>      return s.startswith('/')
> AttributeError: 'file' object has no attribute 'startswith'


altho i cannot help you with your original query, i *can* tell you
that the reason why you get the error is that add() expects a filename
(not a file object).  i think that you have to create a TarInfo object
and use the addfile() method instead but can't confirm that.  anyone
else know?

thanks,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list