> However, one point you have shown very clearly: the second one is much
> easier to tear apart and reassemble.
Sure.
Zen Of Python: Readbility Counts
--
http://mail.python.org/mailman/listinfo/python-list
hi, the following sample (from docs.python.org) is a server that can
actually serve only single client at a time.
In my case I need a simple server that can serve more than one client.
I couldn't find an example on how to do that and be glad to get a
hint.
Thanks in advance
import socket
HOST =
> Even simpler, use Twisted:
I am afraid Twisted is not the right choice in my case. I am looking
for smaller, simpler and minimal server sample.
--
http://mail.python.org/mailman/listinfo/python-list
> See the SocketServer module, both the documentation and the source code.
I firstly looked at this module and its __doc__, yet I still need an
'hello world' sample. and couldn't get it straight how can I write my
own hello world sample with SocketServer objects.
--
http://mail.python.org/mailm
here is its:
# a simple tcp server
import SocketServer
class EchoRequestHandler(SocketServer.BaseRequestHandler ):
def setup(self):
print self.client_address, 'connected!'
self.request.send('hi ' + str(self.client_address) + '\n')
def handle(self):
while 1:
The following is a code I am using for a simple tcp echo server.
When I run it and then connect to it (with Telnet for example) if I
shout down the telnet the CPU tops 100% of usage and saty there
forever.
Can one tell what am I doing wrong?
#code.py
import SocketServer
class MyServer(SocketServ
> data = "dummy"
> while data:
> ...
Thanks Alot
--
http://mail.python.org/mailman/listinfo/python-list
Thank Hrvoje as well
--
http://mail.python.org/mailman/listinfo/python-list
I am about to start a large-scale enterprise project next month (I
insist on using Python instead Java and .NET and I am sure `they` will
thank me eventually).
I was wondering around making my components-and-libraries-shopping-
list and came across PEAK.
My paranoia is that PEAK would make me writ
hi,
in my table the field row_id is type of uniqueidentifier.
when try to fetch the data, pymssql somehow, encodes the values in a
way which yields odd results.
for example:
the value
'EE604EE3-4AB0-4EE7-AF4D-018124393CD7'
is represent as
'\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7'
the only way
this byte array.
On Mar 24, 8:48 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Sun, 23 Mar 2008 22:33:58 -0700 (PDT), Tzury Bar Yochay
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > for example:
> > the value
> > 'EE604E
while I can invoke methods of empty string '' right in typing
(''.join(), etc.) I can't do the same with empty list
example:
>>> a = [1,2,3]
>>> b = [].extend(a)
>>> b
>>> b = []
>>> b.extend(a)
>>> b
[1,2,3]
I would not use b = a since I don't want changes on 'b' to apply on
'a'
do you think t
given two classes:
class Foo(object):
def __init__(self):
self.id = 1
def getid(self):
return self.id
class FooSon(Foo):
def __init__(self):
Foo.__init__(self)
self.id = 2
def getid(self):
a = Foo.getid()
b = self.id
return
On Mar 25, 2:00 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Mar 25, 10:44 pm, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote:
>
>
>
> > given two classes:
>
> > class Foo(object):
> > def __init__(self):
> > self.id = 1
>
> >
> Rather than use Foo.bar(), use this syntax to call methods of the
> super class:
>
> super(ParentClass, self).method()
Hi Jeff,
here is the nw version which cause an error
class Foo(object):
def __init__(self):
self.id = 1
def getid(self):
return self.id
class FooSon(F
On Mar 25, 4:03 pm, Anthony <[EMAIL PROTECTED]> wrote:
> On Mar 25, 11:44 am, Tzury Bar Yochay <[EMAIL PROTECTED]> wrote:
>
> > While my intention is to get 1.2 I get 2.2
> > I would like to know what would be the right way to yield the expected
> > results
>
Hi all,
I would like to thank you all for all the suggestions.
what I did was simply extending the super class data with data from
its child
using the id example, Foo.id = 1 is now = [1] and the FooSon does
self.id.append(2)
the system designer wanted inheritance+java and I wanted Python
+Functi
> and then when my application execute code how can I set path to
> d3dx module to "library.zip/d3dx.py".
> I'm not sure is this properly set question.
use the module zipimport
http://docs.python.org/lib/module-zipimport.html
--
http://mail.python.org/mailman/listinfo/python-list
Although I am experiencing this problem using a specific domain
library (pjsip). Googling this issue show that it is happening to many
libraries in python on mac.
I was wondering whether anyone solved this or alike in the past and
might share what steps were taken.
Note: this python lib works fine
Trying to follow a technique found at bzr I did the following
added to ~/.ssh/authorized_keys the command="my_parder" parameter
which point to a python script file named 'my_parser' and located in /
usr/local/bin (file was chmoded as 777)
in that script file '/usr/local/bin/my_parser' I got the
$ ~/devel/ice/snoip/freespeech$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.DatagramHandler
Traceback (most recent call last):
File "", line 1, in
AttributeErro
What is the reason math.pow yields OverflowError while python itself
can
calculate these large numbers. e.g:
>>> import math
>>> math.pow(100, 154)
1e+308
>>> math.pow(100, 155)
Traceback (most recent call last):
File "", line 1, in
OverflowError: math range error
>>> eval(('100*'* 155)[:-1])
1
> Because math.pow returns a float; 100 ** 155 won't fit in a float.
Sure that is the reason.
May I rephrase, my question:
Why not returning another type as long as we can calculate it?
After all, math module is likely to be used on large numbers as well.
--
http://mail.python.org/mailman/listinfo
On Oct 23, 12:04 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,,
> How can we access the time of message received ( UTC time) of an
> outlook mail in python? As far as I know the time which it displays in
> the mail is not the exact time... this UTC time will be present in
> MIME He
Hi,
The nicest thing I like about py2exe is its library.zip which
encapsulate all the dependencies into one single file.
I wonder if there a script which can do the same for linux/mac osx so
one can ship a python solution as a single file
(instead of starting easy_install per used library on the t
> Mac OS X:http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html
Found these for linux:
http://www.pyinstaller.org/
http://wiki.python.org/moin/Freeze
thanks alot
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Suppose I have the following function
char *generateMessage(char *sender, char *reciever, char *message) ;
now in c I would normally do
char *msg = generateMessage(sender, reciever, message);
// do something
free(msg);
My question is how do I free the memory allocated when I call this
funct
I am trying to create raw socket:
server = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.getprotobyname('ip'))
As a result I get the following error:
Traceback (most recent call last):
File "tcpsrv.py", line 14, in
server = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.get
> When using SOCK_RAW, the family should be AF_PACKET,
> not AF_INET. Note that you need root privileges to do so.
I changed as instructed:
server = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
socket.getprotobyname('ip'))
now I am getting:
Traceback (most recent call last):
File "tcpsrv.
after executing insert
do conection.commit()
--
http://mail.python.org/mailman/listinfo/python-list
> Can someone point me in the right direction? I'm looking for a module
> to monitor the Windows Event Viewer.
http://docs.python.org/lib/module-logging.html
NTEventLogHandler is the one you should use.
happy pythoning
--
http://mail.python.org/mailman/listinfo/python-list
concurrent
connections?
I have no intention of using Twisted or alike since I am looking for
making it as lightweight as possible
Thanks in advance,
Tzury Bar Yochay
# begin of snippet
from socket import *
# Create socket and bind to address
UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.bind(('
On Sep 10, 9:55 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Tzury Bar Yochay wrote:
> > Would the one below will be capable of holding 30 concurrent
> > connections?
>
> UDP is a connectionless datagram protocol, so that question doesn't
> really m
> Transmitting large binary data over UDP? That makes only sense for few
> applications like video and audio streaming. UDP does neither guarantee
> that your data is received nor it's received in order. For example the
> packages A, B, C, D might be received as A, D, B (no C).
>
> Can your protoco
Hi,
I can't find in the documentation the way to use these two functions.
can someone share a simple code that utilize these two functions?
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Gabriel,
I was missing the information how to create a writable buffer.
--
http://mail.python.org/mailman/listinfo/python-list
36 matches
Mail list logo