Re: building an index for large text files for fast access

2006-07-24 Thread Erik Max Francis
alex23 wrote: > The standard library module 'libcache' does exactly what you're > considering implementing. I believe the module you're referring to is `linecache`. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfran

Re: building an index for large text files for fast access

2006-07-24 Thread Neil Hodgson
Yi Xing: > Since different lines have different size, I > cannot use seek(). So I am thinking of building an index for the file > for fast access. Can anybody give me some tips on how to do this in > Python? It depends on the size of the files and the amount of memory and disk you may use

Re: building an index for large text files for fast access

2006-07-24 Thread alex23
Yi Xing wrote: > I need to read specific lines of huge text files. Each time, I know > exactly which line(s) I want to read. readlines() or readline() in a > loop is just too slow. Since different lines have different size, I > cannot use seek(). So I am thinking of building an index for the file >

Re: regular expression - matches

2006-07-24 Thread John Machin
On 22/07/2006 2:18 AM, Simon Forman wrote: > John Salerno wrote: >> Simon Forman wrote: >> >>> Python's re.match() matches from the start of the string, so if you (1) Every regex library's match() starts matching from the beginning of the string (unless of course there's an arg for an explicit s

building an index for large text files for fast access

2006-07-24 Thread Yi Xing
Hi, I need to read specific lines of huge text files. Each time, I know exactly which line(s) I want to read. readlines() or readline() in a loop is just too slow. Since different lines have different size, I cannot use seek(). So I am thinking of building an index for the file for fast access

Re: Help in string.digits functions

2006-07-24 Thread John Machin
Anoop wrote: > Hi All > > I am getting two different outputs when i do an operation using > string.digits and test.isdigit(). Is there any difference between the > two. Your first sentence appears to answer that ..but yes, there's quite a difference. Have you read the manual? > I have given the

Re: Help in string.digits functions

2006-07-24 Thread John McMonagle
On Mon, 2006-07-24 at 22:19 -0700, Anoop wrote: > Hi All > > I am getting two different outputs when i do an operation using > string.digits and test.isdigit(). Is there any difference between the > two. I have given the sample program and the output > > Thanks for ur inputs > > Anoop > > #1: >

Re: prob with struct and byte order

2006-07-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, nephish wrote: > tohex gave me > '53 54 58 S T X > 00 00 00 34 Length!? Decimal 57. > 00 00 00 c8 Type!? Decimal 200. > 70 69 76 6f 74 72 61 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > 74 72 61 63 31 70 69 76 6f 74 00 00 00 00 00 00 00 00 00 00 00 00

stuff 2

2006-07-24 Thread Andrew Coffman
http://www.ferg.org/papers/debugging_in_python.html python and vmware (interface) using super(): super(class, instance).method() class MyConfig(ConfigParser, object): def add_section(self, section) super(MyConfig, self).add_section(section) effing the ineffable: http://maverickphi

Re: Python Stripped CSS Background Image Calls

2006-07-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, JenAsh wrote: > In my python file I have several css calls--they all works except for > the background image CSS call. > > .mystyle { background-image: > url(http://www.mysite.com/images/background.gif); } > > When I try to view it in the browser the code is somehow strip

Re: print function question

2006-07-24 Thread Bertrand-Xavier M.
On Tuesday 25 July 2006 05:52, Eric Bishop wrote: > Why does this work: > > # start > a = 5 > > print a, 'is the number' > > #end, prints out "5 is the number" > > But not this: > > # start > > a = 5 > > print a 'is the number' > > #end, errors out > > The difference here is the comma seperating th

Help in string.digits functions

2006-07-24 Thread Anoop
Hi All I am getting two different outputs when i do an operation using string.digits and test.isdigit(). Is there any difference between the two. I have given the sample program and the output Thanks for ur inputs Anoop #1: ~~ import string test='121206' if test not in string.digits: prin

Re: HELP!!! How do I send an ACK packet in UDP?????

2006-07-24 Thread Joe Knapka
[EMAIL PROTECTED] wrote: > I need my udp server to send an ACK back to the client when it > successfully receives data from the client to let it know not to retry > the send (yes, I do know this is how TCP works but must be in UDP) > I am using this example code I found on the net for the server,

Re: HELP!!! How do I send an ACK packet in UDP?????

2006-07-24 Thread Joe Knapka
[EMAIL PROTECTED] wrote: > I need my udp server to send an ACK back to the client when it > successfully receives data from the client to let it know not to retry > the send (yes, I do know this is how TCP works but must be in UDP) > I am using this example code I found on the net for the server,

Python Stripped CSS Background Image Calls

2006-07-24 Thread JenAsh
In my python file I have several css calls--they all works except for the background image CSS call. .mystyle { background-image: url(http://www.mysite.com/images/background.gif); } When I try to view it in the browser the code is somehow stripped. I only get the following: .mystyle { } How can

Re: Help beautify ugly heuristic code

2006-07-24 Thread Stuart D. Gathman
On Thu, 09 Dec 2004 00:01:36 -0800, Lonnie Princehouse wrote: > I believe you can still do this with only compiling a regex once and > then performing a few substitutions on the hostname. That is a interesting idea. Convert ip matches to fixed patterns, and *then* match the regex. I think I wo

print function question

2006-07-24 Thread Eric Bishop
Why does this work:   # start a = 5   print a, 'is the number' #end, prints out "5 is the number"   But not this:   # start   a = 5   print a 'is the number'   #end, errors out   The difference here is the comma seperating the variable and the string literal. Is the comma some sort of concatenatio

Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread John Machin
Steve Jobless wrote: > Hi, > > I just started learning Python. I went through most of the tutorial at > python.org. But I noticed something weird. I'm not talking about the > __private hack. > > Let's say the class is defined as: > > class MyClass: > def __init__(self): > pass > def

Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Kevin Watters
See: http://redhanded.hobix.com/inspect/monkeypytching.html Shouldn't be done unless you have a really cool reason for doing so. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Jean-Paul Calderone
On Tue, 25 Jul 2006 02:49:06 GMT, Steve Jobless <[EMAIL PROTECTED]> wrote: >Hi, > >I just started learning Python. I went through most of the tutorial at >python.org. But I noticed something weird. I'm not talking about the >__private hack. > >Let's say the class is defined as: > > class MyClass:

Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Steve Jobless
Hi, I just started learning Python. I went through most of the tutorial at python.org. But I noticed something weird. I'm not talking about the __private hack. Let's say the class is defined as: class MyClass: def __init__(self): pass def func(self): return 123 But from th

Re: Which Pyton Book For Newbies?

2006-07-24 Thread hanumizzle
Bob Sinclar wrote: > Web programming is all about stdin & stdout. Recommanded practice > before going further. It's actually a little more (at least as far as CGI is concerned)...it bears some level of abstraction, namely, a decent CGI lib. -- http://mail.python.org/mailman/listinfo/python-list

Re: Search within running python scripts

2006-07-24 Thread Simon Forman
Cameron Laird wrote: ... > Particularly when I hear "os-independent", I think first of > binding to a socket. While http://wiki.tcl.tk/1558 > > is written for a Tcl-based crowd, the commentary there ap- > plies quite well to Python. I was going to suggest something like this, as I have noticed th

HELP!!! How do I send an ACK packet in UDP?????

2006-07-24 Thread myersoft
I need my udp server to send an ACK back to the client when it successfully receives data from the client to let it know not to retry the send (yes, I do know this is how TCP works but must be in UDP) I am using this example code I found on the net for the server, I need to figure out how to get th

Re: How to force a thread to stop

2006-07-24 Thread Paul Rubin
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: > > Communications through Queue.Queue objects can help. But if you > > research the history of this design decision in the language you > > should discover there are fairly sound rasons for not allowing > > arbitrary "threadicide". > > > Right, I'm

Re: Search within running python scripts

2006-07-24 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Simon Forman <[EMAIL PROTECTED]> wrote: >gmax2006 wrote: . . . >> > Yes, there are several ways. What OS are you using? >> > >> > ~Simon >> >> I have to use an os-independent approach. >> >> At

About Embedding PyWin or wxPython

2006-07-24 Thread Mr. Roboto
Folks: I want to embark on a project to add Python (actually, wxPython or PythonWin) to a new Windows app I want to start writing soon. Essentially, I want to take VB6 (or pos Delphi) and construct the app framework/core functionality using one of those languages, then extend the app w/ Python, t

Re: prob with struct and byte order

2006-07-24 Thread John Machin
[EMAIL PROTECTED] wrote: > ok. indeed i did do '' instead of ' '. > here is an example of a message > 'STX\x00\x00\x004\x00\x00\x00\xc8stateman\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00state1man\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ENX' > > tohex gave me '53

Re: Converting a web to pdf or ..‍

2006-07-24 Thread Colin J. Williams
Bayazee wrote: > Hi , > I have a web site and i want to write a perogram with python that my > users can convert custom web page of site to pdf (or other type :jpeg, > doc,odt,or...) and download it . i dont want only convert text . it is > be very good to i can don it for both text and images ...

Re: find_longest_match in SequenceMatcher

2006-07-24 Thread John Machin
John Machin wrote: > koara wrote: > > John Machin wrote: > There is a bug. > I'll report it. Reported. http://sourceforge.net/tracker/index.php?func=detail&aid=1528074&group_id=5470&atid=105470 -- http://mail.python.org/mailman/listinfo/python-list

Re: prob with struct and byte order

2006-07-24 Thread nephish
ok. indeed i did do '' instead of ' '. here is an example of a message 'STX\x00\x00\x004\x00\x00\x00\xc8stateman\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00state1man\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ENX' tohex gave me '53 54 58 00 00 00 34 00 00 00 c8 70 6

Re: micro authoritative dns server

2006-07-24 Thread Edmond Dantes
Jean-Paul Calderone wrote: ... > Twisted includes a DNS server which is trivially configurable to perform > this task. Take a look. > > http://twistedmatrix.com/ > http://twistedmatrix.com/projects/names/documentation/howto/names.html > > Jean-Paul On a tangential note: If you want a DNS

Re: find_longest_match in SequenceMatcher

2006-07-24 Thread John Machin
koara wrote: > John Machin wrote: > > --test results snip--- > > Looks to me like the problem has nothing at all to do with the length > > of the searched strings, but a bug appeared in 2.3. What version(s) > > were you using? Can you reproduce your results (500 & 499 giving > > different answers)

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Joe Knapka
Grant Edwards wrote: > On 2006-07-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >>>Logs of the serial traffic would be helpful. >> >>Here they are. First a log of the traffic generated by the >>T-logger GUI program, abtained with Portmon. > > > I try to avoid Windows as much as humanly

Re: Search within running python scripts

2006-07-24 Thread Simon Forman
gmax2006 wrote: > Simon Forman wrote: > > gmax2006 wrote: > > > Hi, > > > > > > Is it possible that a python script finds out whether another instance > > > of it is currently running or not? > > > > > > Thank you, > > > Max > > > > Yes, there are several ways. What OS are you using? > > > > ~Simo

Re: micro authoritative dns server

2006-07-24 Thread Jean-Paul Calderone
On 24 Jul 2006 14:45:25 -0700, [EMAIL PROTECTED] wrote: >Hi, > >I'm new in python. I know that there are several classes for writing >dns servers, but I don't understand it > >I just want to know if anyone could help me in writing a code for >minimal authoritative dns server. I would like that anyo

micro authoritative dns server

2006-07-24 Thread xan2
Hi, I'm new in python. I know that there are several classes for writing dns servers, but I don't understand it I just want to know if anyone could help me in writing a code for minimal authoritative dns server. I would like that anyone show me the code, minimal, for learn how expand it. The cod

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
On Mon, 24 Jul 2006 13:51:07 -0700, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL >> PROTECTED]> wrote: >> >>> Steve Holden wrote: >>> Carl J. Van Arsdall wrote: [... rant ...]

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Steve Holden wrote: > Carl J. Van Arsdall wrote: > > >> >> > I take this to mean you don't want to do the necessary research? ;-) > Well, i've been looking at this on and off for quite some time now, I almost feel like I've seen it all in regards to the "thread killer" scenario. It co

Re: installing numpy: problems with lapack, blas etc

2006-07-24 Thread Robert Kern
Ken Dere wrote: > I am trying to install numpy-0.9.8 prior to installing scipy (0.4.9) on a > machine running Suse 10.0 with Python 2.4 Please join us on the numpy mailing list. http://www.scipy.org/Mailing_Lists However, you should know now that Suse ships an incomplete ATLAS-optimized LAPA

Re: prob with struct and byte order

2006-07-24 Thread John Machin
Grant Edwards wrote: > On 2006-07-24, Steve Holden <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > >> now the 17758 is significant because it is the actual unit number of > >> the machine we want to monitor. I just dont know how to extract the > >> real values out of this message. >

Re: prob with struct and byte order

2006-07-24 Thread John Machin
[EMAIL PROTECTED] wrote: > the starting and ending deliminators are ASCII 'STX' and 'ENX'. i > wondered why they did it like that also. But they did. > > the message length is a 4 byte integer indicating how long the message > body is. > the message type is also 4 bytes. There is a table in the d

Re: Search within running python scripts

2006-07-24 Thread gmax2006
Simon Forman wrote: > gmax2006 wrote: > > Hi, > > > > Is it possible that a python script finds out whether another instance > > of it is currently running or not? > > > > Thank you, > > Max > > Yes, there are several ways. What OS are you using? > > ~Simon I have to use an os-independent approa

Re: How to force a thread to stop

2006-07-24 Thread Steve Holden
Carl J. Van Arsdall wrote: > Jean-Paul Calderone wrote: [...] >>This has been discussed many many times in the context of many many >>languages and threading libraries. If you're really interested, do >>the investigation Steve suggested. You'll find plenty of material. >> > > > I've been digg

installing numpy: problems with lapack, blas etc

2006-07-24 Thread Ken Dere
I am trying to install numpy-0.9.8 prior to installing scipy (0.4.9) on a machine running Suse 10.0 with Python 2.4 I am able to get numpy installed to the point when I import it I can do the following: numpy.show_config() atlas_threads_info: NOT AVAILABLE blas_opt_info: libraries = ['f77

using Jython in Websphere 6.0

2006-07-24 Thread alfa1234
Used the following command to extract correct commandLine arguments to Automate deployment: AdminApp.installInteractive('z:/Builds_test/sgs/sgs-procDist.ear') Got the following Args to use for deployment.. install 'z:/Builds_test/sgs/sgs-procDist.ear' '[ -preCompileJSPs -installed.ear.destinat

Re: Type signature

2006-07-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, paul kölle wrote: > Marc 'BlackJack' Rintsch wrote: >> In <[EMAIL PROTECTED]>, Yacao Wang >> wrote: >> >>> However, type signatures are not only a kind of information provided for >>> the compiler, but also for the programmer, or more important, for the >>> programmer. Wit

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Grant Edwards
On 2006-07-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Logs of the serial traffic would be helpful. > > Here they are. First a log of the traffic generated by the > T-logger GUI program, abtained with Portmon. I try to avoid Windows as much as humanly possible, but one thing that appears

Re: using names before they're defined

2006-07-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : >>>First case is a little shorter but then you have to use a parser for it >> >>There's one builtin. > > > do you mean 'configparser'? Yes. > I'm just trying to figure out how this > works. One nice thing with Python is the interactive python shell. It makes expl

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Jean-Paul Calderone wrote: > On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> > wrote: > >> Steve Holden wrote: >> >>> Carl J. Van Arsdall wrote: >>> [... rant ...] >>> >>> So with this whole "hey mr. nice thread, please die for me" concept gets >>>

Re: When writing text. . .

2006-07-24 Thread Ivan Shevanski
On 7/14/06, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: On 2006-07-14 18:05:56, Ivan Shevanski wrote:> Hey I'm pretty new to python and I have a question.  I'm trying to write:> "[BOOT]> run=C:\windows\aawin.bat">> in my win.ini > So I went about it like this:>> win = open('C:\windows\win.ini', 'a')

Re: Nested function scope problem

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 17:09:24, Steve Holden wrote: > Would I do? It seems so :) > If there's a binding to a name *anywhere* in the function's body then > that name is treated as local to the function. > > This is a matter of static analysis, and is irrespective of where in the > body the assignment

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Bruno Desthuilliers
Michael Yanowitz a écrit : > Hello: > >Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. That > is I can't have a > def func1 (int1, string1): >and a > def func1 (int1, int3, string1, string2): > without the second func1 o

Re: unittest ValueError

2006-07-24 Thread Steve Holden
Chris Fonnesbeck wrote: > I have built the following unit test, observing the examples laid out > in the python docs: > > class testMCMC(unittest.TestCase): > > def setUp(self): > > # Create an instance of the sampler > self.sampler = DisasterSampler() > > def testCoalMi

Re: Nested function scope problem

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 16:51:56, danielx wrote: > Gerhard's reply sounded not so confident. Yes, it is not. It's just the conclusion I drew from my experiments. (I'm still all wet behind the ears WRT Python...) As long as there was no write access to the variable, the inner function could read the value

Re: Nested function scope problem

2006-07-24 Thread Steve Holden
danielx wrote: > Gerhard Fiedler wrote: [...] >>Yes, but it is the line "tok = ''" that seems to cause tok to be now a >>variable of the inner function's scope (rather than the variable tok of >>breakLine). > > > OHH! Yes, that sounds like it could be it. Wow, to me, that behavior is > eXtremely

Re: Search within running python scripts

2006-07-24 Thread faulkner
IPC via files, sockets, and shared memory are all readily available in python. the simplest way is to have the script write its pid to a certain file. pidfn = '/tmp/hellowerld_ipc_pid' if os.path.isfile(pidfn): f = file(pidfn) pid = f.read() f.close() if pid in os.popen('ps -A -o p

Re: Search within running python scripts

2006-07-24 Thread Simon Forman
gmax2006 wrote: > Hi, > > Is it possible that a python script finds out whether another instance > of it is currently running or not? > > Thank you, > Max Yes, there are several ways. What OS are you using? ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-07-24 Thread danielx
Gerhard Fiedler wrote: > On 2006-07-23 14:53:33, danielx wrote: > > > I can't figure out why Josiah's breakLine function won't work either. I > > know Josiah has had his problem resolved, but I'd still like to know > > why his func won't work. I'd like to redirect this discussion in that > > direct

Re: random shuffles

2006-07-24 Thread Boris Borcic
Paul Rubin wrote: > Boris Borcic <[EMAIL PROTECTED]> writes: >> To be more convincing... assume the algorithm is optimal and calls > > That assumption is not even slightly realistic. Real-world sorting > algorithms almost never do a precisely minimal amount of comparison. 'optimal' or 'minimal a

Re: Comment on this script. Possible error in communication with list arg between functions

2006-07-24 Thread Phoe6
Juho Schultz wrote: > I think return values should be used for communication between > functions. Maybe something like this could work for you (not tested). > > def checkForRpm(rpmname): > # > # Strings with 0 lenght are False > if output: > print output > else: > p

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread alexandre_irrthum
Thanks Grant, > Can you verify that the device is actually responding by > watching the data line with an oscilloscope? I don't have an oscilloscope but the device does respond (LED blinks) when I send it a test command (44H). > I take it that means that other programs are able to read from > th

ldexpf undefined in Python 2.4.3 build on SCO OSR 5.0.5

2006-07-24 Thread edcdave
My (gcc 2.95.2) build of Python 2.4.3 is failing with: gcc -Wl,-Bexport -o python \ Modules/ccpython.o \ libpython2.4.a -lnsl -ldl-lm Undefined first referenced symbol in file ldexpf

Re: prob with struct and byte order

2006-07-24 Thread Grant Edwards
On 2006-07-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > ok, i did this print ' '.join(["%02.2x" % ord(b) for b in message]) > and i got this in the text file > 535458002c00ea31373538343636383535d6090d54454e58 No, I don't think so.

Python and real-time OS timing/task communication?

2006-07-24 Thread Ray Schumacher
Has anyone used Python and a hard real-time OS/patch to schedule timed events? We have started in on Debian and RTAI, and may be using LXRT. (I've been reading http://people.mech.kuleuven.be/~psoetens/lxrt/portingtolxrt.html) I was envisioning that we really only need a separate RT-process in C us

Re: _mssql on Python 2.5 Beta 2

2006-07-24 Thread Andrew MacIntyre
[EMAIL PROTECTED] wrote: > I'm trying to use the _mssql module from > http://pymssql.sourceforge.net/. It works fine on Python 2.4. I've > just installed Python 2.5 Beta 2 on my Linux box and, whenever I try > and run the mssql.close() function, or close the program, I get the > following message

Re: Generating all possible combination of elements in a list

2006-07-24 Thread [EMAIL PROTECTED]
Mir Nazim wrote: > Paul Rubin wrote: > > > 1060! / (1060 - 96)! > > > > > More than you want to think about: > > > > import math > > > > def logf(n): > > """return base-10 logarithm of (n factorial)""" > > f = 0.0 > > for x in xrange(1,n+1): > > f += mat

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 15:05:53, Stefan Behnel wrote: Maybe I am missing something, but from what I've seen, it is not possible to overload functions in Python. That is I can't have a def func1 (int1, string1): and a def func1 (int1, int3, string1, string2):

Re: prob with struct and byte order

2006-07-24 Thread nephish
ok, i did this print ' '.join(["%02.2x" % ord(b) for b in message]) and i got this in the text file 535458002c00ea31373538343636383535d6090d54454e58 so, yes, more of the info seems discernable now. according to their docs, all of their va

Re: Comment on this script. Possible error in communication with list arg between functions

2006-07-24 Thread Juho Schultz
Phoe6 wrote: > Hi all, > Part of my script is to check for pre-requisite rpms to be > installed. > If its installed, I just display the rpm version as in rpm database, > otherwise I output a message saying: > ' rpm is not installed' and collect the rpm name in a list > (notInstalled). > At

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread alexandre_irrthum
Gerhard Fiedler wrote: > On 2006-07-24 14:03:30, [EMAIL PROTECTED] wrote: > > > To read from the chip, one must issue the "read page" command (33h), > > followed by the two-byte address of the requested page (pages are 32 > > bytes long). After receiving this, the DS1615 will send the data in a > >

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Grant Edwards
On 2006-07-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> import serial >>> s = serial.Serial(0, baudrate=9600, bytesize=8, parity='N', stopbits=1, >>> timeout=None) >>> s.write("\x33") >>> s.write("\x00") >>> s.write("\x00") >>> s.read() # "\x00" is returned here. This byte was already i

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Grant Edwards
On 2006-07-24, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-24 14:03:30, [EMAIL PROTECTED] wrote: > >> To read from the chip, one must issue the "read page" command (33h), >> followed by the two-byte address of the requested page (pages are 32 >> bytes long). After receiving this, the DS

Search within running python scripts

2006-07-24 Thread gmax2006
Hi, Is it possible that a python script finds out whether another instance of it is currently running or not? Thank you, Max -- http://mail.python.org/mailman/listinfo/python-list

Re: easy questions from python newbie

2006-07-24 Thread Tim
James Stroud wrote: > John Machin wrote: > > James Stroud wrote: > > > >>walterbyrd wrote: > >> > >>>This is the first real python program I have ever worked on. What I > >>>want to do is: > >>>1) count identical records in a cvs file > >>>2) create a new file with quantities instead duplicate reco

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> Carl J. Van Arsdall wrote: >> [... rant ...] >> >>> So with this whole "hey mr. nice thread, please die for me" concept gets >>> ugly quickly in complex situations and doesn't scale well at

Re: Which Pyton Book For Newbies?

2006-07-24 Thread Bob Sinclar
Web programming is all about stdin & stdout. Recommanded practice before going further. On Monday 24 July 2006 20:08, John Salerno wrote: > Gerhard Fiedler wrote: > > While I don't doubt that there are many applications that are well-suited > > for web apps and that there are a number of good reas

Comment on this script. Possible error in communication with list arg between functions

2006-07-24 Thread Phoe6
Hi all, Part of my script is to check for pre-requisite rpms to be installed. If its installed, I just display the rpm version as in rpm database, otherwise I output a message saying: ' rpm is not installed' and collect the rpm name in a list (notInstalled). At the end if the len(notInstal

Re: Exercises for dive into python

2006-07-24 Thread Gerard Flanagan
Ben Edwards (lists) wrote: > On Mon, 2006-07-24 at 16:39 +, Tal Einat wrote: > > Ben Edwards (lists videonetwork.org> writes: > > > > > > > > Have been working through Dive Into Python which is excellent. My only > > > problem is that there are not exercises. I find exercises are a great >

Re: Functions, Operators, and Overloading?

2006-07-24 Thread bearophileHUGS
Michael Yanowitz: > Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. Maybe here you can find some ideas: http://www.artima.com/forums/flat.jsp?forum=106&thread=101605 http://bob.pythonmac.org/archives/2005/03/30/five-minute-multimethods-

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Steve Holden wrote: > Carl J. Van Arsdall wrote: > [... rant ...] > >> So with this whole "hey mr. nice thread, please die for me" concept gets >> ugly quickly in complex situations and doesn't scale well at all. >> Furthermore, say you have a complex systems where users can write >> pluggab

Re: How to force a thread to stop

2006-07-24 Thread Steve Holden
Carl J. Van Arsdall wrote: [... rant ...] > So with this whole "hey mr. nice thread, please die for me" concept gets > ugly quickly in complex situations and doesn't scale well at all. > Furthermore, say you have a complex systems where users can write > pluggable modules. IF a module gets stu

Re: Which Pyton Book For Newbies?

2006-07-24 Thread John Salerno
Gerhard Fiedler wrote: > While I don't doubt that there are many applications that are well-suited > for web apps and that there are a number of good reasons for making some > apps web-based, why do you think web programming is /not/ GUI programming? Personally I enjoy GUI programming, so I'm no

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Stefan Behnel
Gerhard Fiedler schrieb: > On 2006-07-24 14:30:31, Brian Beck wrote: > >> Michael Yanowitz wrote: >>>Maybe I am missing something, but from what I've seen, >>> it is not possible to overload functions in Python. That >>> is I can't have a >>> def func1 (int1, string1): >>>and a >>> def

unittest ValueError

2006-07-24 Thread Chris Fonnesbeck
I have built the following unit test, observing the examples laid out in the python docs: class testMCMC(unittest.TestCase): def setUp(self): # Create an instance of the sampler self.sampler = DisasterSampler() def testCoalMiningDisasters(self): """Run coal minin

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:03:30, [EMAIL PROTECTED] wrote: > To read from the chip, one must issue the "read page" command (33h), > followed by the two-byte address of the requested page (pages are 32 > bytes long). After receiving this, the DS1615 will send the data in a > burst of (up to) 32 bytes. I'm

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Terry Reedy
"Michael Yanowitz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello: > > Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. That > is I can't have a > def func1 (int1, string1): > and a > def func1 (int1, int3, str

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:30:31, Brian Beck wrote: > Michael Yanowitz wrote: >>Maybe I am missing something, but from what I've seen, >> it is not possible to overload functions in Python. That >> is I can't have a >> def func1 (int1, string1): >>and a >> def func1 (int1, int3, string1, string2

Re: Generating all possible combination of elements in a list

2006-07-24 Thread Mir Nazim
Paul Rubin wrote: > > 1060! / (1060 - 96)! > > More than you want to think about: > > import math > > def logf(n): > """return base-10 logarithm of (n factorial)""" > f = 0.0 > for x in xrange(1,n+1): > f += math.log(x, 10) > return f > > pr

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:41:02, Gerhard Fiedler wrote: > (I actually think that possibly the current way of embedding javadoc-like > documentation into sources is only a stepping stone into the direction > generally pointed to by what Wirth called "literate programming". That was Knuth, not Wirth. But t

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:25:14, fuzzylollipop wrote: >> So... the final authority /is/ the code. I don't see an alternative. For >> me, good abstraction doesn't mean I don't have to read the sources; good >> abstraction means (among other things) that I can read the sources easily. > having auto generate

Re: prob with struct and byte order

2006-07-24 Thread Grant Edwards
On 2006-07-24, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> hello there, all. >> >> i have a difficult app that connects to a server to get information for >> our database here. >> this server is our access point to some equipment in the field that we >> monitor. >> >> th

Re: Exercises for dive into python

2006-07-24 Thread Ben Edwards (lists)
On Mon, 2006-07-24 at 16:39 +, Tal Einat wrote: > Ben Edwards (lists videonetwork.org> writes: > > > > > Have been working through Dive Into Python which is excellent. My only > > problem is that there are not exercises. I find exercises are a great > > way of helping stuff sink in and ver

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Brian Beck
Michael Yanowitz wrote: >Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. That > is I can't have a > def func1 (int1, string1): >and a > def func1 (int1, int3, string1, string2): > without the second func1 overwriting the f

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread aaronwmail-usenet
Steve Holden wrote: ... > I wouldn't waste your time. "A man convinced against his will is of the > same opinion still", and they already know they aren't interested in > Python. There are probably many other matters about which they are > uninformed and equally determined This is too true. F

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Dennis Lee Bieber wrote: > On Sat, 22 Jul 2006 14:47:30 +0200, "Hans" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > >> Hi all, >> >> Is there a way that the program that created and started a thread also stops >> it. >> (My usage is a time-out). >> >> > Hasn'

Re: Type signature

2006-07-24 Thread Hugo Ferreira
Which is expecially true when using IDEs with auto-completion.Using VisualStudio/MonoDevelop and C# I rarely need to look at the documentation because I can quickly see what a method accept and returns. And when I need to pass flags or options, enums are much more neat and encapsulated. With Python

Re: Detecting socket connection failure

2006-07-24 Thread Dieter Maurer
[EMAIL PROTECTED] writes on 19 Jul 2006 08:34:00 -0700: > ... > Were you also using mac osx? No, I have observed the problem under Linux. > Dieter Maurer wrote: > > > I have seen something similar recently: > > > > I can write ("send" to be precise) to a socket closed by > > the foreign

Re: Which Pyton Book For Newbies?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:39:20, John Salerno wrote: > But I think the usual caveat for GUI programming is, is it necessary? > Would it work just as well to make a website interface to do your work, > rather than spend the time learning a GUI toolkit and creating a GUI > app? While I don't doubt that ther

Re: prob with struct and byte order

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hello there, all. > > i have a difficult app that connects to a server to get information for > our database here. > this server is our access point to some equipment in the field that we > monitor. > > the messages come in over a socket connection. And according to the

  1   2   >