Re: Persistent Distributed Objects
Sorry about being interpreted as being vague. `et me try to narrow it down. program a creates objects b c d which each need to use 1 disk space 2 ram 3 processor time. I would like to create a heckpoint which would save the work of the object to be later used and then delete it from memory [which I assume from reading about them implimented elsewhere is more or less how they work]. The other part would be to assign the objects via a network depending on the number of network machines. I.e. suppose b c and d see machines e f g on a network they can send those machines objects b c and d and have any work saved on the main machine or local ones. What I was wondering is how would I do that in python. The arbitrary part could be no more complicated than a program where b is calculating a list of prime numbers from x to infinity c is just a notepad program and d is a program that prints say the size of the file as youi type it and says I like writing a poem of [bytes big] while m y computer foun ou that [new prime] is the biggest on [machines #] computers. Rmi supposedly does this for the distribuited part. Object persistence does this for saving to the best of what I`ve seen nothing distributes and saved at the same time. Does that help? The death of one man is a tragedy. The death of ten million is a statistic--- Joseph Stalin --Original Message-- From: Laszlo Nagy gand...@shopzeus.com To: John Haggerty bouncy...@gmail.com,python-list (General) python-list@python.org Date: Fri, 9 Oct 2009 09:18:12 PM +0430 Subject: Re: Persistent Distributed Objects I've seen evidence about this being done wrt what looks like insanely complex stuff on this list but I'm wondering if there is something to do this with any number of nodes and just farm out random classes/objects to them? Designing and opreating distributed systems is a complex thing. Especially if you do not want to specify an exact problem domain that you needed to solve - then you need to design a distributed system that is able to solve general problems. It is very complex, and - at least to my knowledge - there is no efficient solution out of the box. This is not Python specific. It would be a hard task just to design how that system should work, regardless of the computer language it is implemented in. L -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic Form--Potential purge cache?
Personally that sounds like the data needs to be deliberately oveerittren in the form. That or the cache has to be cleared by a remote instruction. Unfortunately I know how to do neither :[ --Original Message-- From: Simon Forman sajmik...@gmail.com To: python-list@python.org Date: Tue, 22 Sep 2009 11:34:25 AM -0400 Subject: Re: Dynamic Form On Tue, Sep 22, 2009 at 10:46 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have a dynamic form in which I do the following: 1) Request two fields (company name, number of entries). That is sent back to the form. 2) If the two fields are not None, the form requests other data. That, too, is sent back to the form. 3) That new data is then entered into a MySQL table. The problem is, that when I go back to refresh the form, the data is re-entered into the table! How do I prevent that? TIA, Victor First, this seems like it's not a python question, rather it's seems to be about some web stuff. Second, there's not enough information to tell you anything useful. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing managers and socket connection.
Is this server something you wrote from scratch or something that is just being used. Some details are left out -- --Original Message-- From: Chris chris...@gmail.com To: python-list@python.org Date: Fri, 18 Sep 2009 09:10:15 AM -0700 Subject: Re: multiprocessing managers and socket connection. On Aug 31, 10:41 pm, Terry terry.yin...@gmail.com wrote: On Aug 26, 7:25 pm, Chris chris...@gmail.com wrote: On Aug 25, 9:11 pm, Terry terry.yin...@gmail.com wrote: On Aug 25, 10:14 pm, Chris chris...@gmail.com wrote: I've been using multiprocessing managers and I really like the functionality. I have a question about reconnecting to a manager. I have a situation where I start on one machine (A) a manager that is listening and then on another machine (B) connects to that manager and uses its proxy object to call functions on the manager's computer; this all works as expected. But, if the manager from A shuts down, B's application won't notice because in the MP code it ignores socket error errno.ECONNREFUSED. If A becomes available again or is restarted, B doesn't automatically reconnect either and continue its operation. It's function is basically stopped. Here is the code from connection.py: while 1: try: s.connect(address) except socket.error, e: if e.args[0] != errno.ECONNREFUSED: # connection refused debug('failed to connect to address %s', address) raise time.sleep(0.01) else: break How can I have B automatically reconnect to A and continue its work once A is available again? I think you need to retry repeatedly until successfully connected. br, Terry I'm having issue after once connected. If the server goes down during a long-running connection. I would want to be notified so I could try to reconnect. I'm doing more experimenting now and will try to post an example. Hi Chris, Are you sure that the proxy object keeps a permanent connection to the server? br, Terry Sorry for the delay in response. I was able to find a solution by NOT using sockets, but using PIPES instead. The socket connections to the managers don't disconnect properly. Here's how to reproduce the situation (yes it's a stupid example, but that's the point): mp_manager_test.py -- http://python.pastebin.com/m3d10e343 mp_manager_test_client.py -- http://python.pastebin.com/m7a8fda4c run the following sequence which requires 3 shells. shell1 python mp_manager_test.py start_server shell2 python mp_manager_test_client.py shell3 python mp_manager_test.py stop_server Run the 3rd line while the client is accessing the server. When you use the socket for a connection, it hangs. When you use a PIPE, it throws the exception and actually exits; so I can catch the exception and handle it properly instead of having a hanging program. I am not sure how well a remote pipe will work though as I have yet to try it over a network between machines. To switch from socket to pipe, just switch the comments at the top in the source files: ADDY = (127.0.0.1,9000) ADDY2 = (127.0.0.1,9001) #ADDY = r'\\.\pipe\PipeName' #ADDY2 = r'\\.\pipe\PipeName2' Chris -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Incremental project based programming guide
I was wondering if anyone had actually designed their programming text around incremental parts of a project and then taken the results of the project at each chapter and created something of value. specifically in referwnce to python however other examples. ALl of education was around pointless and unapplicable theory texts for which I am reaping nothing. Surely someone has seen this in actiom to whit: ch1 design of problem ch2 design taken out of ch1 then done in ch2 to take input/ output for a smaller part ch3 take info from chs 1...@2 to craft an answer that is from the same problemto a theoretical chapter say 30 with a gui or some such. deitel and associates were unfortunately part of some of my worst exampes--drills applenty with little to no application. much appreciated towards python application and thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: VT100 in Python
I hate to ask but what kind of device.and what`s with all the `insult` strings? - gimmick? --Original Message-- From: exar...@twistedmatrix.com To: python-list@python.org Date: Mon, 14 Sep 2009 01:43:11 PM + Subject: Re: VT100 in Python On 09:29 am, n...@craig-wood.com wrote: Wolfgang Rohdewald wolfg...@rohdewald.de wrote: On Sunday 13 September 2009, Nadav Chernin wrote: I'm writing program that read data from some instrument trough RS232. This instrument send data in VT100 format. I need only to extract the text without all other characters that describe how to represent data on the screen. Is there some library in python for converting VT100 strings? that should be easy using regular expressions At a basic level parsing VT100 is quite easy, so you can get rid of the VT100 control. They start with ESC, have other characters in the middle then end with a letter (upper or lowercase), so a regexp will make short work of them. Something like r\x1B[^A-Za-z]*[A-Za-z] You might need to parse the VT100 stream as VT100 builds up a screen buffer though and the commands don't always come out in the order you might expect. I think twisted has VT100 emulator, but I couldn't find it in a brief search just now. Yep, though it's one of the parts of Twisted that only has API documentation and a few examples, no expository prose-style docs. If you're feeling brave, though: http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalTransport.html http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalProtocol.html http://twistedmatrix.com/projects/conch/documentation/examples/ (the insults section) It's not really all that complicated, but without adequate docs it can still be tricky to figure things out. There's almost always someone on IRC (#twisted on freenode) to offer real-time help, though. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode - and MIMEType - Good friday fun.
How do you suppose it should workand how is it working? what about the outpout difference? -- Sent via Cricket Mobile Email --Original Message-- From: rh0dium steven.kl...@gmail.com To: python-list@python.org Date: Fri, 11 Sep 2009 04:33:42 PM -0700 Subject: Unicode - and MIMEType - Good friday fun. Hi Geniuses, Can anyone please show me the way.. I don't understand why this doesn't work... # encoding: utf-8 from email.MIMEText import MIMEText msg = MIMEText(hi) msg.set_charset('utf-8') print msg.as_string() a = 'Ho\xcc\x82tel Ste\xcc\x81phane ' b = unicode(a, utf-8) print b msg = MIMEText(b) msg.set_charset('utf-8') print msg.as_string() It should right?? Thanks! -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Turn-based game - experimental economics
As I Understand it I Would just use a simple shared variable or perhaps data wrote to a file to indicate busy or waiting and then use some kind of wait function or no-op to simulate' then recheck -- Sent via Cricket Mobile Email --Original Message-- From: Paolo Crosetto paolo.crose...@unimi.it To: python-list@python.org Date: Sat, 5 Sep 2009 12:07:59 PM +0200 Subject: Turn-based game - experimental economics Dear all, I am writing an application in Python for an experiment in Experimental Economics. For those who do not know what this is: experimental economics uses controlled, computerised lab experiments with real subjects, putting the subject in a game mimicking the situation of interest and collecting behavioural data about choices made. Hence, experiments involve the use of a multi-client architecture with one server, and are sort of online games, with actions taken by clients and computation, data collection, etc... handled by servers. I chose to use Python because I needed something flexible, powerful and easy - I am a beginner programmer. My game is a sort of scrabble, with palyers buying letters and producing words or extending existing words. I use a pipe to ispell -a for spellcheck, XMLRPC for the server-client infrastructure, and have developed all the rules of the game as server functions, called by a client. States of players and of words created are stored in instances of two basic classes, Player and Word, on the server side. The problem I now face is to organise turns. Players, as in Scrabble, will play in turns. So far I have developed the server and ONE client, and cannot get my head round to - nor find many examples of - how to simply develop a turn-based interaction. I basically need the server to freeze in writing all the clients while client i is playing, then when i is over passing the turn to i+1; clients are still accessible by the server at any time (the payoff of a player changes even as she is not playing, by royalties collected from other players extending her words). In another thread (about a battleship game) I found two possible leads to a solution: 1. using 'select'. 2. using threads. But in both cases I could not find any clear documentation on how to do this. The 'select' road was said to be the easiest, but I found no further hints. Does anyone have any hints? thanks! -- Paolo Crosetto - PhD Student in Economics DEAS - Department of Economics - University of Milan - -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list