Re: Question about idioms for clearing a list

2006-02-06 Thread Fredrik Lundh
Steven D'Aprano wrote: > > so we can have three ways to do the same thing? the right way to > > nuke a sequence is to do "del L[:]". this is explained in Python 101. > > The Zen isn't "only one way to do it". If it were, we > wouldn't need iterators, list comps or for loops, > because they can a

jython problem importing a py file

2006-02-06 Thread didier . prophete
Ok, so I know this is probably a common jython error, but somehow I can't seem to find an answer to this trivial problem. Ok, I have the following (simple) directory structure: $TOP/ __init__.py py_dir/ __init__.py util.py I have: PYTHONPATH=$TOP CLASSPATH=$TOP I am n

Re: Webmail with Python

2006-02-06 Thread Michael Ströder
Paul Rubin wrote: > Thomas Guettler <[EMAIL PROTECTED]> writes: > >>Yes, Zope or Plone are to heavyweight for this. I will use squirrelmail, >>I think it stable. I hope that I don't need to touch the PHP code. > > Be careful, Squirrelmail had some annoying privacy bugs which the > maintainers (as

Re: fairly large webapp: from Java to Python. experiences?

2006-02-06 Thread George Sakkis
> Any tips, stories, recommendations, and/or experiences are most > welcome. Just one suggestion, read the article "Things You Should Never Do, Part I" first ( http://www.joelonsoftware.com/articles/fog69.html). Quoting from the article: (Netscape made) "the *single worst strategic mistak

Re: Code Feedback

2006-02-06 Thread mwt
Thanks for all the feedback. Interestingly, I can't seem to get Dan M's code: [code] try: while 1: pass except KeyboardInterrupt: break [/code] to work, no matter how many variations I try (including adding in "time.sleep(0.1)" as Peter Hansen suggested. Th

Re: numeric expression from string?

2006-02-06 Thread Blair P. Houghton
Steven wrote: >Do you think your users might enter something Evil and break their own system? That's not usually how it works. How it usually works is: 1. Innocent code-monkey writes nifty applet, posts on usenet. 2. Innocent but dull-witted framework manufacturer includes nifty applet in Next

Re: in over my head ascii

2006-02-06 Thread Blair P. Houghton
[EMAIL PROTECTED] wrote: > What do you bet the server software was written by someone > who thought ASCII STX meant literally the characters "STX"? Wouldn't explain the "ENX" instead of "ETX". > I've seen stupider things. I give it 25% probability of being what you said, and 75% probability that

RPy / R

2006-02-06 Thread jason
Hello: I installed the following: python-2.4.2.msi pywin32-207.win32-py2.4.exe R-2.2.1-win32.exe rpy-0.4.6-R-2.0.0-to-2.2.1-py24.win32.exe on a Windows XP (SP2) box. When I try to run the following (source: http://rpy.sourceforge.net/plotting-with-RPy.html) in IDLE >>> from rpy import * >>> x

Re: numeric expression from string?

2006-02-06 Thread Blair P. Houghton
Steven wrote: >Do you think your users might enter something Evil and break their own system? That's not usually how it works. How it usually works is: 1. Innocent code-monkey writes nifty applet, posts on usenet. 2. Innocent but dull-witted framework manufacturer includes nifty applet in Next

Best Job Search Site...

2006-02-06 Thread ang27
--_NextPart_9763-0059-0BDBD09A-1D04 Content-Type: text/plain Content-Transfer-Encoding: 7bit If you are looking for a job or know someone who is then check out the hot jobs section of http://www.2spendless.com! This site really helped me. --_NextPart_9763-0059-0BDBD09A-1D04-- -- h

Re: numeric expression from string?

2006-02-06 Thread Alex Martelli
Brian Blais <[EMAIL PROTECTED]> wrote: > someone might accidentally do damage to their system with an unchecked eval. Nah, it takes malice and deliberation to damage a system from an eval. Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting line endings

2006-02-06 Thread Alex Martelli
Fuzzyman <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm trying to detect line endings used in text files. I *might* be > decoding the files into unicode first (which may be encoded using Open the file with 'rU' mode, and check the file object's newline attribute. > My worry is that if '\n' *do

Re: Getting Tkinter Text contents before destruction

2006-02-06 Thread James Stroud
Bob Greschke wrote: > Hi! > > I want to grab the contents of a Text widget when the frame it's on gets > destroyed. I tried TextWidget.bind(""... , but the widget is gone > before the call gets made, and I'd really hate to do something with the > function that gets called with TextWidgetsFrame

Getting Tkinter Text contents before destruction

2006-02-06 Thread Bob Greschke
Hi! I want to grab the contents of a Text widget when the frame it's on gets destroyed. I tried TextWidget.bind(""... , but the widget is gone before the call gets made, and I'd really hate to do something with the function that gets called with TextWidgetsFrame.bind("", ..., since that one f

readline tokenizer newline sticky wicket

2006-02-06 Thread Arthur
Given a "linemess.py" file with inconsistent line ending: line 1 \r \r\n line \n tokenized as per: import tokenize f=open('linemess.py','r') tokens=tokenize.generate_tokens(f.readline) for t in tokens: print t get output as follows: (1, 'line', (1, 0), (1, 4), 'line 1\r\n') (2, '1', (1, 5)

Weekly Python Patch/Bug Summary

2006-02-06 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 391 open ( +0) / 3038 closed (+10) / 3429 total (+10) Bugs: 915 open ( +9) / 5540 closed (+21) / 6455 total (+30) RFE : 209 open ( +2) / 197 closed ( +0) / 406 total ( +2) New / Reopened Patches __ difflib e

Re: * 'struct-like' list *

2006-02-06 Thread Raymond Hettinger
[Ernesto] > I'm still fairly new to python, so I need some guidance here... > > I have a text file with lots of data. I only need some of the data. I > want to put the useful data into an [array of] struct-like > mechanism(s). The text file looks something like this: > > [BUNCH OF NOT-USEFUL DAT

Re: Generators vs. Functions?

2006-02-06 Thread Bengt Richter
On Sun, 05 Feb 2006 19:14:29 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Sun, 05 Feb 2006 03:31:24 +, Neil Schemenauer wrote: > >> Peter Hansen <[EMAIL PROTECTED]> wrote: >>> More precisely, the state of the function is *saved* when a yield >>> occurs, so you certainly don't *recrea

Re: Literal Escaped Octets

2006-02-06 Thread Steve Holden
Chason Hayes wrote: > On Mon, 06 Feb 2006 13:39:17 +, Steve Holden wrote: [...] >> >>The URL you reference is discussing how you represent arbitrary values >>in string literals. If you already have the data in a Python string the >>best advise is to use a parameterized query - that way your P

Re: datetime object from string

2006-02-06 Thread Raymond Hettinger
Douglas Douglas wrote: > Hi everybody. > > I need to create a datetime object from a string like "20/01/2005 15:10:01". I > know the mxDateTime module can do this with the DateTimeFrom method, but I was > wondering if is possible to do this using only the standard library. > > I read the datetime o

BayPIGgies: Feb 9, 7:30pm (Ironport)

2006-02-06 Thread Aahz
The next meeting of BayPIGgies will be Thurs, February 9 at 7:30pm at Ironport. This meeting features PyCon practice talks by Wes Chun, Jimmy Retzlaff, and possibly others. BayPIGgies meetings alternate between IronPort (San Bruno, California) and Google (Mountain View, California). For more in

ANN: pyfuncgen

2006-02-06 Thread Bill Scherer
Hello - I'm pleased to announce my first sourceforge project, pyfuncgen. pyfuncgen is a virtual Function Generator. I've created it to assist me with some tube audio amplifier testing. Currently it generates sine, square, and sawtooth waveforms. A gui (pyqt) and a cli are included. The cli depen

Re: Question about idioms for clearing a list

2006-02-06 Thread Steven D'Aprano
Fredrik Lundh wrote: > Peter Hansen wrote: > > >>>Perhaps it is arguable that there is no need for a clear method because >>>L[:] = [] is so easy to do. Personally, while I agree that it is easy, it >>>is hardly intuitive or obvious, and I too would prefer an explicit clear >>>method for mutable

Re: Using bytecode, not code objects

2006-02-06 Thread Terry Reedy
"Raymond Hettinger" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Fabiano Sidler wrote: >> with pdb (which I'm surely not using as neatly as it could be). Or is >> there any documentation on it I couldn't find? > > The pysassem module is part of the compiler package: > > http:

Re: in over my head ascii

2006-02-06 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > i know that those characters exist, the docs say that the server does > not want the special "ETX" and "STX" characters, but the 3 ascii > characters "STX" and "ENX" i am not sure why. What do you bet the server software was written by someone who thought ASCII STX mean

Re: UTF16, BOM, and Windows Line endings

2006-02-06 Thread Neil Hodgson
Fuzzyman: > Thanks - so I need to decode to unicode and *then* split on line > endings. Problem is, that means I can't use Python to handle line > endings where I don't know the encoding in advance. > > In another thread I've posted a small function that *guesses* line > endings in use. You

Re: Global variables, Classes, inheritance

2006-02-06 Thread DaveM
Thanks very much for the help to all who replied. I'd completely missed the difference between: class Foo: i = 12345 a = Foo() b = Foo() a.i = 678 and Foo.i = 678 Yeah, I know... DaveM -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Peter A.Schott
Thanks, I'll give this a try when I get a chance and will post back if we have any issues. -Pete "Grig Gheorghiu" <[EMAIL PROTECTED]> wrote: > subprocess gets my vote too. > > You can do something like: > > from subprocess import call, Popen, PIPE, STDOUT > > def run_cmd(cmd): > arglist =

datetime object from string

2006-02-06 Thread Douglas Douglas
Hi everybody. I need to create a datetime object from a string like "20/01/2005 15:10:01". I know the mxDateTime module can do this with the DateTimeFrom method, but I was wondering if is possible to do this using only the standard library. I read the datetime object reference but didn't find a m

Re: a question regarding call-by-reference

2006-02-06 Thread Kent Johnson
enjoying the view wrote: > Imported normally this would work fine. The list given as a parameter > would be one element larger. But when the stubs are generated, the > function doesn't return anything and the list is appended in the server > and the client-side list is left untouched. At first I th

Re: Best way to capture output of another command-line program in Win32?

2006-02-06 Thread billie
Another way: >>> import popen2 >>> exec_cmd = popen2.popen4('dir') >>> output = exec_cmd[0].read() >>> print output [...] 04/02/2006 21.44 106 setup.py 06/02/2006 23.25 656 time_synch.py 07/02/2006 00.5216.885 knockd.log 07/02/2006 00.35 6.37

Re: a question regarding call-by-reference

2006-02-06 Thread Claudio Grondi
enjoying the view wrote: > I am working on a school project, trying to build a simple RPC stub > generator. The idea is that the generator takes a normal python file > with functions defined in it and produces a client and server stub. The > client stub has the same functions defined, but they just

Re: how to kill a python process?

2006-02-06 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Jorgen Grahn <[EMAIL PROTECTED]> wrote: ... > > It doesn't work on my system; I just get yet another process called > > python. > > Strange ... the other shebang-able programs (interpreters) I run (/bin/sh, > perl) work like I described. That's something I expect t

Re: Code Feedback

2006-02-06 Thread snoe
I believe the while 1: pass is there to keep the main thread alive until all the readers are done. If you want the program to end after the readers are done you can append them all to a list then iterate through and wait for the threads to join() if __name__=="__main__": library = Library()

Re: Code Feedback

2006-02-06 Thread Jorgen Grahn
On 6 Feb 2006 09:33:58 -0800, mwt <[EMAIL PROTECTED]> wrote: > Hello - > Last night I wrote my first code in Python -- a little > producer/consumer toy to help me begin to understand things. The > "Library" only has a few books. You can choose how many Readers are ... > 1) Is this good Python code?

Re: Best way of finding terminal width/height?

2006-02-06 Thread Jorgen Grahn
On Mon, 06 Feb 2006 15:17:43 -, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-02-06, Joel Hedlund <[EMAIL PROTECTED]> wrote: [finding the terminal dimensions] >> access to the termios module either. So, in the latter case >> I'm back to square one, which is arbitrary guesswork. > > Yes,

Re: UTF16, BOM, and Windows Line endings

2006-02-06 Thread Fuzzyman
Neil Hodgson wrote: > Fuzzyman: > > > How should I handle line-endings for UTF16 ? Is it possible that other > > programs (on windows) will have line endings as u'\r\n' ? > > Yes, try Notepad and save as Unicode. For the text > > Fuzzy > End of lines > > >>> contents = open("C:\\fuzzy.txt", "

Re: triple quoted strings as comments

2006-02-06 Thread Jorgen Grahn
On 6 Feb 2006 12:53:53 GMT, Volker Grabsch <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: [...] developer had commented out about 50 lines of C++ code by just putting a /* at the top and a */ at the bottom. > [...] >> ("#if 0" in C and C++ are better choices, but only marginally.

Re: how to kill a python process?

2006-02-06 Thread Jorgen Grahn
On 5 Feb 2006 12:21:50 -0800, MackS <[EMAIL PROTECTED]> wrote: > Hi Jorgen > > You wrote that: > >> $ head -1 foo3.py >> #!/usr/bin/python >> $ ./foo3.py >> >> This is the traditional shebang form used for shell and Perl scripts, >> and it names the process 'foo3.py' so you can killall(1) it nicel

Re: a question regarding call-by-reference

2006-02-06 Thread Paul McGuire
"enjoying the view" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am working on a school project, trying to build a simple RPC stub > generator. The idea is that the generator takes a normal python file > with functions defined in it and produces a client and server stub. The > cl

Re: Compiling

2006-02-06 Thread Martin v. Löwis
Ravi Teja wrote: > But more often I am looking to use Python libraries > in other languages since I am more familiar with them and they > typically tend to be more high level (the way I like it) than the > standard libraries of others. Ah. In that case, the normal C API should work fine to call in

python

2006-02-06 Thread Brain Murphy
I am new to python and programming but i was wondering, what can i program with python?? Brian Yahoo! Photos – NEW, now offering a quality print service from just 8p a photo.-- http://mail.python.org/mailman/listinfo/python-list

Re: Code Feedback

2006-02-06 Thread Peter Hansen
Dan M wrote: >>2) Anybody know how to alter the "while 1: pass" section to make the >>app stoppable? > > > That one I think I can help with! See below. > > >>while 1: pass > > > try: > while 1: > pass > except KeyboardInterrupt: > break That migh

Re: cannot install scipy

2006-02-06 Thread Travis Oliphant
Robert Kern wrote: > nitro wrote: > >>Hi, >> >>I am using a Debian system. I installed NumPy and everything works >>well. When I try to install SciPy, I get the following error. Any help >>would be appreciated. >> >>=== >>[EMAIL PROTECTED]:~/scipy/scipy-0.4.4$ python setup.py install >>import core

Re: UTF16, BOM, and Windows Line endings

2006-02-06 Thread Neil Hodgson
Fuzzyman: > How should I handle line-endings for UTF16 ? Is it possible that other > programs (on windows) will have line endings as u'\r\n' ? Yes, try Notepad and save as Unicode. For the text Fuzzy End of lines >>> contents = open("C:\\fuzzy.txt", "rb").read() >>> contents '\xff\xfeF\x

Re: Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Grig Gheorghiu
subprocess gets my vote too. You can do something like: from subprocess import call, Popen, PIPE, STDOUT def run_cmd(cmd): arglist = cmd.split() p = Popen(arglist, stdout=PIPE, stderr=STDOUT) output = p.communicate()[0] return (p.returncode, output) rc, output = run_cmd("python

Re: Using bytecode, not code objects

2006-02-06 Thread Raymond Hettinger
Fabiano Sidler wrote: > 2006/1/29, Fabiano Sidler <[EMAIL PROTECTED]>: > > 28 Jan 2006 22:02:45 -0800, Raymond Hettinger <[EMAIL PROTECTED]>: > > > But if you want to make your life unnecessarily hard, you can hack the > > > compiler module just upstream from the creation of the code object -- > >

Unable to get PIL to load jpeg images

2006-02-06 Thread peter . mosley
Hello again I'm still wrestling with Python / Tkinter / PIL. I have almost got it to work - on a Fedora Core 1 system I can now display images in a Tkinter window. But I also run a Fedora Core 3 system, and when I tried the same procedures I get the following errors:- [EMAIL PROTECTED] jpgTest]

Re: * 'struct-like' list *

2006-02-06 Thread Paul McGuire
"Ernesto" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm still fairly new to python, so I need some guidance here... > > I have a text file with lots of data. I only need some of the data. I > want to put the useful data into an [array of] struct-like > mechanism(s). The text

Re: Detecting line endings

2006-02-06 Thread Fuzzyman
Sybren Stuvel wrote: > Fuzzyman enlightened us with: > > My worry is that if '\n' *doesn't* signify a line break on the Mac, > > then it may exist in the body of the text - and trigger ``ending = > > '\n'`` prematurely ? > > I'd count the number of occurences of '\r\n', '\n' without a preceding >

Re: Question about idioms for clearing a list

2006-02-06 Thread Steven D'Aprano
On Mon, 06 Feb 2006 09:39:32 -0500, Dan Sommers wrote: > On Tue, 07 Feb 2006 01:01:43 +1100, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Mon, 06 Feb 2006 13:35:10 +, Steve Holden wrote: I'm wondering why there is no 'clear' for lists. It feels like a common operation for mu

Re: Using bytecode, not code objects

2006-02-06 Thread Fabiano Sidler
2006/1/29, Fabiano Sidler <[EMAIL PROTECTED]>: > 28 Jan 2006 22:02:45 -0800, Raymond Hettinger <[EMAIL PROTECTED]>: > > But if you want to make your life unnecessarily hard, you can hack the > > compiler module just upstream from the creation of the code object -- > > alter the newCodeObject() meth

Re: Code Feedback

2006-02-06 Thread Dan M
> 2) Anybody know how to alter the "while 1: pass" section to make the > app stoppable? That one I think I can help with! See below. > while 1: pass try: while 1: pass except KeyboardInterrupt: break -- http://mail.python.org/mailman/listinf

Re: script to read emails and extract attachments from cron

2006-02-06 Thread Dan M
On Mon, 06 Feb 2006 10:57:23 -0800, [EMAIL PROTECTED] wrote: > Hi: > > I am looking for advice on the best way to set up a process to read > incoming emails (from a normal unix mailbox on the same host) > containing a gzipped telemetry attachment. I'd like the script to > extract the attachment i

Dr. Dobb's Python-URL! - weekly Python news and links (Feb 6)

2006-02-06 Thread Magnus Lycka
QOTW: "Excessive cleverness can lead to unmaintainable code. So can excessive stupidity." -- Alan Morgan "Also Python code is pretty bare-metal, so that file.write or socket.write go to the syscall immediately. Try that in Java and you'll find 30 layers of complex abstractions for doubtful benef

Re: in over my head ascii

2006-02-06 Thread nephish
i know that those characters exist, the docs say that the server does not want the special "ETX" and "STX" characters, but the 3 ascii characters "STX" and "ENX" i am not sure why. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about idioms for clearing a list

2006-02-06 Thread Mel Wilson
Fredrik Lundh wrote: > (del doesn't work on dictionaries) ... or rather [:] doesn't work on dictionaries ... Python 2.4.2 (#1, Jan 23 2006, 21:24:54) [GCC 3.3.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d={'a':1, 'b':2, 'c':3} >>> print d {'a': 1, 'c

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
Tim and Carsten, Thank you very much for your replies. I'm afraid this is not going to work for me (but I'm not 100% sure), coz if I access those modules from the Python's C API (PyModule_* functions), the PyModule_Check() calls will fail. Thanks again. -- http://mail.python.org/mailman/listinfo/

Re: in over my head ascii

2006-02-06 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > ok, part of what i have to do is know how many bytes will be sent. in > ascii is it one byte per character ? > like "password" would be 8 bytes long? Yes, but when someone says ASCII STX, they usually mean the single byte control character. This is a non-printable chara

Re: Accessing Windows Serial Port

2006-02-06 Thread Grant Edwards
On 2006-02-06, George T. <[EMAIL PROTECTED]> wrote: > I need to access the serial port via python on a windows machine. > Reading on the web, there are three solutions: pyserial, siomodule and > USPP. You can also just use win32 stuff directly (CreateFile et al). > pyserial seems to be the best

Re: Accessing Windows Serial Port

2006-02-06 Thread Roel Schroeven
George T. schreef: > I need to access the serial port via python on a windows machine. > Reading on the web, there are three solutions: pyserial, siomodule and > USPP. pyserial seems to be the best option since the other two are > tested with Windows 95 and older versions of python. Would you ag

Re: threads and memory

2006-02-06 Thread Lee Leahu
Hi List, > > I am running into a problem where asyncore is through a filedescriptor > > error if I try to launch more that 1023 connections: > > > > Traceback (most recent call last): > > File "./test.py", line 46, in ? > > asyncore.loop() > > File "/us

Re: in over my head ascii

2006-02-06 Thread nephish
ok, part of what i have to do is know how many bytes will be sent. in ascii is it one byte per character ? like "password" would be 8 bytes long? -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and memory

2006-02-06 Thread Fredrik Lundh
Lee Leahu wrote: > > Yes. You don't need one thread per connection: > > http://docs.python.org/lib/module-asyncore.html > > I am running into a problem where asyncore is through a filedescriptor > error if I try to launch more that 1023 connections: > > Tracebac

Re: Webmail with Python

2006-02-06 Thread Paul Rubin
Thomas Guettler <[EMAIL PROTECTED]> writes: > Yes, Zope or Plone are to heavyweight for this. I will use squirrelmail, > I think it stable. I hope that I don't need to touch the PHP code. Be careful, Squirrelmail had some annoying privacy bugs which the maintainers (as of the last time I messed wi

Accessing Windows Serial Port

2006-02-06 Thread George T.
I need to access the serial port via python on a windows machine. Reading on the web, there are three solutions: pyserial, siomodule and USPP. pyserial seems to be the best option since the other two are tested with Windows 95 and older versions of python. Would you agree with this or have I mis

Re: Replace a module variable with a function call

2006-02-06 Thread Carsten Haese
On Mon, 2006-02-06 at 14:38, [EMAIL PROTECTED] wrote: > Your post didn't provide any help at all, it was a useless sarcastic > post and I'm a very sensible person. Your original question didn't provide enough detail to offer an answer, which is why I asked the question what the dynamic return valu

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
Your post didn't provide any help at all, it was a useless sarcastic post and I'm a very sensible person. -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and memory

2006-02-06 Thread Bryan Olson
Lee Leahu wrote: > I am trying to write a simple threaded application which will > simulate 1000 connections to a remote service in order to > stress test" that the remote service can handle that many > connections. That shouldn't be a problem on a modern OS, but there are still quite a few not

Re: Replace a module variable with a function call

2006-02-06 Thread Carsten Haese
On Mon, 2006-02-06 at 14:19, [EMAIL PROTECTED] wrote: > I'm not going to waste my time with more > examples coz probably you won't understand them either. Fine, I won't waste my time trying to help you. -Carsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace a module variable with a function call

2006-02-06 Thread Tim Hochberg
[EMAIL PROTECTED] wrote: > I have a module that defines a variable with a constant value and now I > need to make that value dynamic, without affecting module clients. In > other words, I need to call a function witout using parenthesis. > Example: > > mymod.py-- > > def value

Re: Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Fredrik Lundh
Peter A.Schott wrote: > Not sure what I should do here. I know that DOS/CMD can capture the output of > EXE files in Win32. I know that os.popen() has been recommended for this, but > the couple of times I've tried, it didn't seem to work well. I haven't had a > lot of need to do this recently,

Re: Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
There are modules (like os) that define some stuff that depends on the platform (for example linesep). This platform dependent constants gets their values assigned when the module gets loaded, but in our application, different threads might run on different computers (by proxying syscalls).. and we

Best way to capture output of another command-line program in Win32?

2006-02-06 Thread Peter A.Schott
Not sure what I should do here. I know that DOS/CMD can capture the output of EXE files in Win32. I know that os.popen() has been recommended for this, but the couple of times I've tried, it didn't seem to work well. I haven't had a lot of need to do this recently, but we're trying to automate s

Re: Replace a module variable with a function call

2006-02-06 Thread Carsten Haese
On Mon, 2006-02-06 at 13:54, [EMAIL PROTECTED] wrote: > I have a module that defines a variable with a constant value and now I > need to make that value dynamic, without affecting module clients. In > other words, I need to call a function witout using parenthesis. > Example: > > mymod.py

script to read emails and extract attachments from cron

2006-02-06 Thread [EMAIL PROTECTED]
Hi: I am looking for advice on the best way to set up a process to read incoming emails (from a normal unix mailbox on the same host) containing a gzipped telemetry attachment. I'd like the script to extract the attachment into a directory where another process will pick it up. I plan to run it ev

Replace a module variable with a function call

2006-02-06 Thread gabriel . becedillas
I have a module that defines a variable with a constant value and now I need to make that value dynamic, without affecting module clients. In other words, I need to call a function witout using parenthesis. Example: mymod.py-- def value(): return "hi" client.py---

Re: critique my code, please

2006-02-06 Thread Scott David Daniels
Brian Blais asked for suggestions and critiques of his code. For style, look at: http://www.python.org/peps/pep-0008.html This is how I'd rewrite the first class: YESNO = ('No', 'Yes') class SimulationParams(object): '''Simulation Parameters setting up of a simulation'''

Re: in over my head ascii

2006-02-06 Thread nephish
i think like byte 1 = 'S' byte 2 = 'T' and byte 3 = 'X' still new at this, and thanks for the references -sk -- http://mail.python.org/mailman/listinfo/python-list

Re: threads and memory

2006-02-06 Thread Lee Leahu
Hi List, > >I am trying to write a simple threaded application which will simulate 1000 > >connections to a remote service in order to "stress test" that the remote > >service can handle that many connections. > [...] > >Is there a way to accomplish what I am trying to do, perhaps in a more > >

Re: in over my head ascii

2006-02-06 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > for example , to send a request, the first three bytes have to be ascii > "STX" > then there has to be 4 bytes that show the length of the message > then the actual message > then the last three bytes have to be "ENX" > > also all int

com how to PumpWaitingMessages in a thread

2006-02-06 Thread puff
When interfacing to a COM object, is it possible to pump messages in a thread? I'm working on an application that automates IE and needs to monitor IE events (yes I know about Pamie). I'm able to start IE as follows: ie = win32com.client.DispatchWithEvents( object, YamieEvents ) ie.event

Re: Scientific Computing with NumPy

2006-02-06 Thread Travis E. Oliphant
Tim Hochberg wrote: > mclaugb wrote: > > > No, Scientific Python is "a collection of Python modules that are useful > for scientific computing" written by Konrad Hinsen. I'm not a user, but > you can find information here: > > http://starship.python.net/~hinsen/ScientificPython/ > > Sci

Re: Thread imbalance

2006-02-06 Thread Bryan Olson
Tuvas wrote: > The read function used actually is from a library in C, for use over a > CAN interface. The same library appears to work perfectly find over C. [...] > When nothing is happening, the thread runs pretty consistantly at 1 > second. However, when it is doing IO through this C function o

Re: Question about idioms for clearing a list

2006-02-06 Thread Fredrik Lundh
Peter Hansen wrote: > > Perhaps it is arguable that there is no need for a clear method because > > L[:] = [] is so easy to do. Personally, while I agree that it is easy, it > > is hardly intuitive or obvious, and I too would prefer an explicit clear > > method for mutable sequences. > > Possibly

a question regarding call-by-reference

2006-02-06 Thread enjoying the view
I am working on a school project, trying to build a simple RPC stub generator. The idea is that the generator takes a normal python file with functions defined in it and produces a client and server stub. The client stub has the same functions defined, but they just connect to the server and ask it

Re: Question about idioms for clearing a list

2006-02-06 Thread Peter Hansen
Steven D'Aprano wrote: > Perhaps it is arguable that there is no need for a clear method because > L[:] = [] is so easy to do. Personally, while I agree that it is easy, it > is hardly intuitive or obvious, and I too would prefer an explicit clear > method for mutable sequences. Possibly another c

Re: critique my code, please

2006-02-06 Thread gry
Just a few suggestions: 1) use consistant formatting, preferably something like: http://www.python.org/peps/pep-0008.html E.g.: yesno = {0:"No", 1:"Yes", True:"Yes", False:"No"} 2) if (isinstance(self.random_seed,str)): s=s+"Random Seed: %s\n" % self.random_seed else:

Re: Thread imbalance

2006-02-06 Thread Bryan Olson
Peter Hansen wrote: > Ivan Voras wrote: >> Python is bad for concurrently executing/computing threads, but it >> shouldn't be that bad - do you have lots of compute-intensive threads? > > Just in case anyone coming along in the future reads this statement, for > the record I'd like to say this i

Re: how to kill a python process?

2006-02-06 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "MackS" <[EMAIL PROTECTED]> wrote: > I just read that on some systems perl allows you to rename the > process by assigning to $0: > > http://www.linuxquestions.org/questions/showthread.php?t=401299 > > Is there a way to do the same in python? My trouble is that

Re: Scientific Computing with NumPy

2006-02-06 Thread Robert Kern
mclaugb wrote: > Has anyone recompiled the Scientific Computing package using NumPy instead > of Numeric? What "Scientific Computing" package? I don't know of any package under that name. AFAIK, Konrad Hinsen has not yet ported his ScientificPython package to numpy, yet. scipy 0.4+ is ported to

Re: Scientific Computing with NumPy

2006-02-06 Thread Tim Hochberg
mclaugb wrote: > Is Scipy the same thing as ScientificPython? > I am confused if SciPy is just the new version. they appear to be separate > things. > Bryan No, Scientific Python is "a collection of Python modules that are useful for scientific computing" written by Konrad Hinsen. I'm not a use

Re: Thread imbalance

2006-02-06 Thread Tuvas
The read function used actually is from a library in C, for use over a CAN interface. The same library appears to work perfectly find over C. I wrote an extention module for it. The function t_config is the threaded function that will call a function called config once per second. Note the time.tim

[ANN] Pydev Extended: Pydev Extensions 1.0 release

2006-02-06 Thread Fabio Zadrozny
Hi All, Pydev Extensions 1.0 has been released Check the homepage (http://www.fabioz.com/pydev/) for more details. Pydev Extensions is a commercial product, and works with Eclipse and the Pydev "Open Source" version, and has features such as: * Code completion with auto-import * Code a

Re: problem in ElementTree SubElement

2006-02-06 Thread Fredrik Lundh
Sbaush wrote: > I would get this element in xml: > > > > I have write this: > > date=ET.SubElement(idsreq,"date") > date.set("month",month) > date.set("day",day) > > but i get this: > > > > The attributes are not in my order!! > how i can get the attributes in right order??? XML

Re: Scientific Computing with NumPy

2006-02-06 Thread Robert Kern
mclaugb wrote: > Is Scipy the same thing as ScientificPython? > I am confused if SciPy is just the new version. they appear to be separate > things. They are separate projects. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed

Re: Scientific Computing with NumPy

2006-02-06 Thread Travis E. Oliphant
mclaugb wrote: > Is Scipy the same thing as ScientificPython? No. They are two separate projects. Scientific Python is still Numeric-only. SciPy 0.3.x is Numeric-based and SciPy 0.4.x is NumPy-based. The developers for NumPy are also the developers for SciPy (for the most part). There is a

[ANN] PyDev 1.0 released

2006-02-06 Thread Fabio Zadrozny
Hi All, PyDev - Python IDE (Python Development Enviroment for Eclipse) version 1.0 has been released. Check the homepage (http://pydev.sourceforge.net/) for more details. Details for Release: 1.0 Yeap, that's right, Pydev has reached its 'adulthood', so... enjoy it! Major highlights:

problem in ElementTree SubElement

2006-02-06 Thread Sbaush
Hi all. I would get this element in xml:I have write this: date=ET.SubElement(idsreq,"date")        date.set("month",month)        date.set("day",day)but i get this: The attributes are not in my order!!how i can get the attributes in right order??? Thanks all.-- Sbaush -- http://mail.python.org/m

Code Feedback

2006-02-06 Thread mwt
Hello - Last night I wrote my first code in Python -- a little producer/consumer toy to help me begin to understand things. The "Library" only has a few books. You can choose how many Readers are trying to check out the books. When no books are available, they have to wait until some other Reader r

  1   2   >