attaching Tkinter Listbox to python list object
I am trying to find some method of attaching a Listbox object to a list object so as the contents of the list are changed the contents of the Listbox will be updated to match. I have found a few references to something like this in this old post http://groups.google.com/group/comp.lang.python/browse_thread/thread/3a6fe7534c812f55/43f201ab53cfdbf7 as well as here http://effbot.org/zone/wck-4.htm . It just seems that there should be some way of achieving this. The only this I can think of is create a subclass of list that deletes and then refills the Listbox every time that the list changes, but this seems very in efficient. Any ideas? Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: running python on xp command prompt
On Mar 17, 2:15 pm, [EMAIL PROTECTED] wrote: > Hi, > > I have a simple question about running python on windows xp command > prompt. The file is as follows and is named spam.py: > > print 2**8 > print 'the bright side' + 'of life' > print "hello world" > > I run this on the command prompt as follows > > C:\Documents and Settings\User>python C:\Documents and Settings\User > \Desktop\spa > m.py > python: can't open file 'C:\Documents': [Errno 2] No such file or > directory > > and get the error above. If I surround the second directory in quotes > like this > > C:\Documents and Settings\User>python "C:\Documents and Settings\User > \Desktop\spa > m.py" > > , there is no error. Does anyone know why this is. > > Thank you It is because of the spaces in the path. The command prompt assumes that when it encounters a space that is the end of the attribute. By surrounding it in quotes you are indicating that it is all one attribute. Steve -- http://mail.python.org/mailman/listinfo/python-list
Pickle and Instance Methods
I have a class that I am trying to pickle. One of the attributes is used to set a callback e.g. self.attribute.setCallback(self.callbackfunction). I understand that this cannot be saved by pickle. My question is, is there another way of setting a callback that would agree with pickle? If not is there some way to make pickle ignore the problem attribute? Thanks, Steve -- http://mail.python.org/mailman/listinfo/python-list
mirroring files and data via http
I'm working on a project to create a central administration interface for several websites located on different physical servers. You can think of the websites as a blog type application. My administration application will be used to create new blog posts with associated media (images, etc..) So I am thinking to setting up a script on each of the sites to "phone home" once per day and download any new posts and media files. I am thinking of transmitting the post data in an xml format that could then be decoded an recorded into the database on the slave site. Are there any easy ways to encode a python dictionary to and from xml? For the media files I am thinking that the administration interface would also provide an xml file with a list of all of the media files required along with an http path to retrieve them and a checksum of some sort to verify that they were downloaded correctly. Basically I am trying to figure out if anything already exists to perform some of these functions or if I have to make them from scratch. I know none of it should be too hard, but I hate to re- invent the wheel. Thanks, Steven Potter -- http://mail.python.org/mailman/listinfo/python-list
Re: mirroring files and data via http
On Jul 6, 8:19 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Steve Potter wrote: > > I'm working on a project to create a central administration interface > > for several websites located on different physical servers. > > > You can think of the websites as a blog type application. My > > administration application will be used to create new blog posts with > > associated media (images, etc..) > > > So I am thinking to setting up a script on each of the sites to "phone > > home" once per day and download any new posts and media files. > > > I am thinking of transmitting the post data in an xml format that > > could then be decoded an recorded into the database on the slave > > site. Are there any easy ways to encode a python dictionary to and > > from xml? > > > For the media files I am thinking that the administration interface > > would also provide an xml file with a list of all of the media files > > required along with an http path to retrieve them and a checksum of > > some sort to verify that they were downloaded correctly. > > > Basically I am trying to figure out if anything already exists to > > perform some of these functions or if I have to make them from > > scratch. I know none of it should be too hard, but I hate to re- > > invent the wheel. > > > Thanks, > > > Steven Potter > > It sounds like JSON would be perfect for this. For working with it in > Python, the simplejson module is popular: > > <http://pypi.python.org/pypi/simplejson> > -- Matt, You are correct JSON would be much easier to deal with than xml. That takes care of several of the problems. Now it really just comes down to the file transfer from one server to the other and a verification of some sort that the file transfer was not corrupt. Is there a python module that takes care of file downloads and verification? Thanks, Steve -- http://mail.python.org/mailman/listinfo/python-list