hex string into binary format?
Hi, How do I get a hexvalued string to a format recognized for binary calculation? import binascii s1 = '1C46BE3D9F6AA820' s2 = '8667B5236D89CD46' i1 = binascii.unhexlify(s1) i2 = binascii.unhexlify(s2) x = i1 ^i2 TypeError: unsupported operand type(s) for ^: 'str' and 'str' Many TIA T -- http://mail.python.org/mailman/listinfo/python-list
RE: Generating RTF with Python
I'll use http://www.tug.org/ or a smaller solution http://lout.sourceforge.net/ together with one of many Python template solutions to generate to generate reports. HTH T -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Jung Sent: Thursday, March 31, 2005 4:02 PM To: python-list@python.org Subject: Generating RTF with Python Hi, does anyone know of a high-level solution to produce RTF from Python (something similar to Reportlab for producing PDF)? Thanks, Andreas -- http://mail.python.org/mailman/listinfo/python-list
inter threading info
Hi All, Q: Is it possible for a thread on SocketServer.ThreadingTCPServer to get the socket info of *other* open thread/s and use that info to send data to the accepting client? I wrote a socketserver using SocketServer.ThreadingTCPServer. A client is connected to the server and expects multiple request/responses. (Not sure about the terminology but the client connects and then stay connected for a while.) I need to create a client that can connect to server and then determine how many other clients are connected, what the socket info is (ifile/ofile) and then send and receive specific data to those clients. TIA T -- http://mail.python.org/mailman/listinfo/python-list
RE: inter threading info
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Dittmar Sent: Wednesday, March 23, 2005 4:46 PM To: python-list@python.org Subject: Re: inter threading info Tertius Cronje wrote: Q: Is it possible for a thread on SocketServer.ThreadingTCPServer to get the socket info of *other* open thread/s and use that info to send data to the accepting client? A specific socket can be used from every thread of a process. Just make sure that you synchronize everything. I need to create a client that can connect to server and then determine how many other clients are connected, what the socket info is When you accept a socket client, a new socket is created, so you cannot determine how many clients are connected to a socket. You have to create a data structure where you insert info about accepted connections and delete the info when a connection is closed. I was thinking of a dict or list _global_ to the StreamRequestHandler.handle() method. That way I can pass the info on with every new connection where the server will have access to it. (ifile/ofile) and then send and receive specific data to those clients. ifile/ofile are local to the server process so you cannot use them to send data from one client to another client. You have to send the data to the server first with a special tag, the server has to use that tag and send the data to the designated other client. That's what I had in mind thanks. The server needs to keep track of all the connected clients. It sounds a bit as if you want to build some kind of chat server and now you want to add private channels. Sounds like it but isn't. I'm busy developing a test/mock harness for a financial switch. Currently it caters only for messages from the client to the harness and then back. I need to add functionality that when an _external_ message arrives, the switch can determine which client it needs to send the data to. Many thanks Tertius -- http://mail.python.org/mailman/listinfo/python-list
Static parameter count
Hi all, This does not feel Pythonic. Is there a better way to do the same? Many TIA T # L = [1,2,3,4,5,6, etc] # L can contain 'n' elements # fmt is made up to each particular specification if len(L) == 0: return '' elif len(L) == 1: return struct.pack(fmt,L[0] ) elif len(L) == 2: return struct.pack(fmt,L[0] , L[1]) elif len(L) == 3: return struct.pack(fmt,L[0] , L[1], L[2]) elif len(L) == 4: return struct.pack(fmt,L[0] , L[1], L[2], L[3]) elif len(L) == 5: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4]) elif len(L) == 6: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4], L[5]) # etc... etc... etc ... -- http://mail.python.org/mailman/listinfo/python-list
RE: Static parameter count
elif len(L) == 5: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4]) elif len(L) == 6: return struct.pack(fmt,L[0] , L[1], L[2], L[3], L[4], L[5]) # etc... etc... etc ... return struct.pack(fmt, *L) Should do the trick ola Many thanks! It *did* the trick! T -- http://mail.python.org/mailman/listinfo/python-list
RE: Good use for Jython
Other than being used to wrap Java classes, what other real use is there for Jython being that Python has many other GUI toolkits available? Also, these toolkits like Tkinter are so much better for client usage (and faster) than Swing, so what would be the advantage for using Jython? or Is Jython really just so that Java developers can write Java code faster? Just as many on this list, my favorite development tool/language/environment is Python. However as nice as it is, there are many frameworks and business applications that is written and packaged in Java (i.e. X25 comms Libraries, log4J *before* python brought out logging) _OR_ has a Java remote interface that must be accessed (EJB /JMS / RMI etc...) _OR_ has a library you prefer to use of over the python implementation (not a lot of those). Jython allows one to use these packages using ones language of choice :) Thanks Jython -- http://mail.python.org/mailman/listinfo/python-list