[Tutor] python CLI parser
Hello, could you have a short review of my CLI package. What it provides is a simple interface to create a shell. I'll be using it inside a bot I'm writing to manage it. Features: * pluggable commands * works over streams instead of stdin/stdout/stderr so it should be network aware (right?) Unfeatures: * not documented at all, right now Todos (for me of course, not for you, but open to suggestions): * import readline * provide TAB completion * make CTRL+d also a quitcommand * remove hardcoded quitCommands only provide defaults Necessary interface for a command: function(*args) returning a string (No smart output of dicts, list or suche yet) Builtin commands are noop and and echo. To run it do python main.py To leave it use quit or exit any comments are welcome, especially how I could make CTRL+d leave my shell and I'm not looking at something that provides, I'm pretty sure someone did a similiar thing already :) thanks martin -- http://noneisyours.marcher.name http://feeds.feedburner.com/NoneIsYours cli.tar.bz2 Description: BZip2 compressed data ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] tarfile +stdin
Hello, I'm trying to create a backup script which in one of the last steps is to create a tarball that is possibly gzipped or bzipped2. import tarfile tbz = tarfile.open(name=tarfile.tar.bz2, mode=w:bz2) tbz.add(myfile.dmp) for tarinfo in tbz: ... print tarinfo.name ... myfile.dmp Now how would I open stdin to add files to this tarball? import sys tbz.add(sys.stdin) Traceback (most recent call last): File stdin, line 1, in module File /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/tarfile.py, line 1333, in add and os.path.abspath(name) == os.path.abspath(self.name): File /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/posixpath.py, line 403, in abspath if not isabs(path): File /Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/posixpath.py, line 49, in isabs return s.startswith('/') AttributeError: 'file' object has no attribute 'startswith' happy about all hints thanks martin smime.p7s Description: S/MIME cryptographic signature ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor