Re: datetime string conversion error

2010-03-16 Thread Jordan Apgar
On Mar 16, 3:07 pm, Christian Heimes wrote: > Jordan Apgar wrote: > > Hey all, > > I'm trying to convert a string to a date time object and all my fields > > convert except for month which seems to default to january. > > > here's what I'm

datetime string conversion error

2010-03-16 Thread Jordan Apgar
Hey all, I'm trying to convert a string to a date time object and all my fields convert except for month which seems to default to january. here's what I'm doing: date = "2010-03-16 14:46:38.409137" olddate = datetime.strptime(date,"%Y-%m-%j %H:%M:%S.%f") print date print olddate I get: 2010-03

Binary data transfer issue

2010-03-15 Thread Jordan Apgar
Hi all, I'm trying to transfer a binary file over xmlrpclib. My test file is a .jpeg file. I can transfer all the data over but when I go to open the .jpeg I get "Error interpreting JPEG image file (Invalid JPEG file structure: SOS before SOF)" here's the code: ===Various Shared Funct

fork vs threading.Thread

2010-02-12 Thread Jordan Apgar
I'm trying to run two servers in the same program at once. Here are the two: class TftpServJ(Thread): def __init__(self, ip, root, port=69, debug = False ): Thread.__init__(self) setup stuff here def run(self): try: self.server.listen(self.ip, self.port

Pycrypto RSA ciphertext to string back to ciphertext issue

2010-02-11 Thread Jordan Apgar
Hey all, I'm trying to convert the encrypted data from RSA to a string for sending over xmlrpc and then back to usable data. Whenever I decrypt I just get junk data. Has anyone else tried doing this? Here's some example code: from Crypto.PublicKey import RSA from Crypto import Random key = RSA

SimpleXMLRPCServer and client address

2010-02-10 Thread Jordan Apgar
I'm trying to right a server that needs specific information for each client accessing it. The easiest way I could think of doing this is keeping this information based on ip address (the information is only valid for a short time). I know there is no was to get the client's address directly and

SocketServer error: AttributeError: instance has no __call__ method

2010-02-10 Thread Jordan Apgar
Hey guys, I'm having some issues connecting to my Socket Server, I get this traceback on the sever side: Exception happened during processing of request from ('127.0.0.1', 56404) Traceback (most recent call last): File "/usr/lib/python2.6/SocketServer.py"

Re: Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:27 pm, Legrandin wrote: > > gkey = RSA.generate(384, Random.new().read) > > string = str((gkey.publickey().__getstate__(),(333,444))) > > You are encrypting with RSA a piece of data which is way > larger than the key size (48 bytes). ah thanks Legrandin -- http://mail.python.org/mail

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:51 pm, Jean-Michel Pichavant wrote: > Jordan Apgar wrote: > > thanks JM, > > > at this point i switched over to this scheme and now I'm getting an > > error durring instantiation of the server: > > Server.py: > > from Crypto.PublicKey im

Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
I am trying to encrypt public data along with another tuple and then decrypt it after sending. RSA is needed for negotiation of keys for AES. But I just get garbage after I decrypt it. This is what I'm attempting to do: from Crypto.PublicKey import RSA from Crypto import Random gkey = RSA.generat

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple(f.readline()[0:-1]) H

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
> http://docs.python.org/library/socketserver.html > > JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? -- http://mail.python.org/mailman/list

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
I found my car ;) here's the server: class commServer: """Class to hold a tcp server and interact with with it allows for a wrapper around socket class to keep code clean""" def __init__ (self, host, hostid, port, buff =1024): self.host = host self.hostid = hostid #id

errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
I have a simple tcp server and client where the server sits and waits for a message and then processes it, my client sends its first message to the server. On the server I receive: socket.error: [Errno 107] Transport endpoint is not connected when calling msg = self.socket.recv(self.buffer) My c