Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Is there standard library modules handling this ? currently I need to turn it into a long integer and do the shift and compare. A little Googling turned up this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440560 -Peter --

Re: System tray Icon

2005-10-24 Thread Mike C. Fletcher
I have a sample up here: http://blog.vrplumber.com/scripts/recordingdevices.py using wxPython. The sample application is Linux-specific, but it should give you a fairly good idea of how to use the system tray icon control in wxPython. HTH, Mike Mike Pippin wrote: How would I have an

Re: Binding a variable?

2005-10-24 Thread Paul Dale
Thanks everyone for your comments and suggestions! I haven't quite decided which approach I'll take, but it's nice to have some options. Paul Tom Anderson wrote: On Fri, 21 Oct 2005, Paul Dale wrote: Is it possible to bind a list member or variable to a variable such that temp = 5 list

Re: output from external commands

2005-10-24 Thread darren kirby
quoth the James Colannino: Hey everyone. First off, I'm new to the list. I had had a little bit of experience with Perl before discovering Python. The more Python I learn, the more I love it :) I just have a quick question to ask. I know that this is probably a simple question, but I've

Re: Set an environment variable

2005-10-24 Thread Eric Brunel
On Fri, 21 Oct 2005 20:13:32 -, Grant Edwards [EMAIL PROTECTED] wrote: On 2005-10-21, Mike Meyer [EMAIL PROTECTED] wrote: Grant Edwards [EMAIL PROTECTED] writes: My point: the OP wanted to know how to export an environment variable to a child process. Either of the lines of code above

Re: Syntax across languages

2005-10-24 Thread Fredrik Lundh
Tom Anderson wrote: This is taken from the AI 754 standard, i take it? :) Seriously, that's horrible. Fredrik, you are a bad man, and run a bad railway. However, looking at the page the OP cites, the only mention of that operator i can find is in Dylan, and in Dylan, it's nothing

Re: create user message for wxPython

2005-10-24 Thread Frithiof Andreas Jensen
James Hu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, There are 2 wxPython application, A and B and need to exchange msg. I do not think that wx even has a mechanism for sending events between applications.? You need some other tool, like a socket, a named pibe, some windows

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
Michael Ekstrand wrote: On Friday 21 October 2005 07:07, bruno modulix wrote: Python is more like Java. troll Err... Python is more like what Java would have been if Java was a smart dynamic hi-level object oriented language !-) /troll +1. Python is easily applicable to most of the

Re: IDE recommendation please

2005-10-24 Thread Adriaan Renting
kery [EMAIL PROTECTED] 10/23/05 9:33 am Alex Martelli wrote: microsnot [EMAIL PROTECTED] wrote: Any suggestions for Linux, specifically SuSE or perhaps Red Hat? Thanks in advance, Kery Eric3 -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Python vs Ruby

2005-10-24 Thread bruno modulix
Scott David Daniels wrote: bruno modulix wrote: ... Another language that failed to make it to the mainstream but is worth giving a try is Smalltalk - the father of OOPLs (Simula being the GrandFather). I would say Simula is the forefather of modern OOPLs, and Smalltalk is the

New User

2005-10-24 Thread thatchmatic
I just downloaded and I think installed python. I am not sure if I did cause it does'nt respond to the commands that the read me file told me to use. Also can someone suggest a trial program I can maybe write for fun? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread [EMAIL PROTECTED]
thanks, that is basically what I am doing and since it is a recipe, I would assume there is no standard library module for it. Peter Hansen wrote: [EMAIL PROTECTED] wrote: Is there standard library modules handling this ? currently I need to turn it into a long integer and do the shift and

Re: Python vs Ruby

2005-10-24 Thread bruno modulix
Alex Martelli wrote: (snip) Here's a tiny script showing some similarities and differences: def f() i = 0 while i 100 j = 923567 + i i += 1 end end f() comment out the 'end' statements, and at colons s/at/add/ at the end of the def and while statements, and

Re: Python vs Ruby

2005-10-24 Thread Iain King
Tom Anderson wrote: On Fri, 21 Oct 2005, vdrab wrote: You can tell everything is well in the world of dynamic languages when someone posts a question with nuclear flame war potential like python vs. ruby and after a while people go off singing hymns about the beauty of Scheme... +1

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread Christoph Haas
On Monday 24 October 2005 10:21, [EMAIL PROTECTED] wrote: thanks, that is basically what I am doing and since it is a recipe, I would assume there is no standard library module for it. Well, http://py.vaults.ca/~x/parnassus/apyllo.py/126307487 lists a few. I had used IPy in the past. But

Re: New User

2005-10-24 Thread Fredrik Lundh
thatchmatic wrote: I just downloaded and I think installed python. I am not sure if I did cause it does'nt respond to the commands that the read me file told me to use. Also can someone suggest a trial program I can maybe write for fun? what happens when you type python at a command

Re: New User

2005-10-24 Thread Christoph Haas
On Sunday 23 October 2005 03:46, thatchmatic wrote: I just downloaded and I think installed python. I am not sure if I did cause it does'nt respond to the commands that the read me file told me to use. Also can someone suggest a trial program I can maybe write for fun? Try

Re: Zope and Persistence

2005-10-24 Thread bruno modulix
[EMAIL PROTECTED] wrote: I don't know if this is the appropriate place to post a Zope question Nope. You'd better use the zope mailing-list for this. OT but I figure many here are familiar with it. I'm confused about the role of the ZMI when it comes to development. As it's name implies, the

Re: Tricky Areas in Python

2005-10-24 Thread bruno modulix
PyPK wrote: hmm Thats one thing. Also I was thinking of something like benefites of python over other languages. That's fairly context-dependant *and* subjective. -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL

Re: Tricky Areas in Python

2005-10-24 Thread Steven D'Aprano
Alex Martelli wrote: I like to present code that seems like it should work, but has some kind of relatively subtle problem, either of correctness in some corner case, or of performance, etc -- and I ask them what they would say if they were to code-review that code, or how they would help a

several interpreters and suspend script

2005-10-24 Thread Mike
Hello All, I'm working ( and a beginner ) with mixing Python scripting and C++. And I need some little help. :) I've searched on the net, but found no answer. So I ask you directly. Globally, I'd like to do 2 things. The first, when I'm in the program, I call a script, which call a function

Re: IDE recommendation please

2005-10-24 Thread Franz Steinhaeusler
On Sun, 23 Oct 2005 14:54:38 +1000, microsnot [EMAIL PROTECTED] wrote: I'm new to Python but am wondering what IDE Python developers use? I use DrPython ;) I use Mac OS X 10.4.2. I have PythonIDE which comes with MacPython but I don't think that has even rudimentary intellisense. DrPython

Re: IDE recommendation please

2005-10-24 Thread Franz Steinhaeusler
On 23 Oct 2005 18:39:17 -0700, Brendan [EMAIL PROTECTED] wrote: As mentioned, there isn't a whole lot. I've beta tested Komodo, and it looks promising. SPE might start working now that stani has a mac. For now I use TextWrangler - a free text editor with good python support.

Re: wxPython advice

2005-10-24 Thread Miki Tebeka
Hello vpr, I've written a p2p program using socketserver that's nice and quick. I'd like to give the user a tray applet (part of the p2p service) that will allow the user to activate / deactivate / config and exit the service. However I'm starting to bang my head on the mainloop funtions

Re: Would there be support for a more general cmp/__cmp__

2005-10-24 Thread Antoon Pardon
Op 2005-10-21, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: It would be better if cmp would give an indication it can't compare two objects instead of giving incorrect and inconsistent results. If two objects aren't totally comparable, then using 'cmp' on them is

Setting a Limit to the Maximum Size of an Upload

2005-10-24 Thread Joey C.
Hello, I'm designing a small briefcase program that will allow me to quickly upload, download, and delete files in a briefcase. The only real things that I have left to do are to design a method for checking if the file exists, preventing it from overwriting files from other directories, and

Re: Setting a Limit to the Maximum Size of an Upload

2005-10-24 Thread Fredrik Lundh
Joey C. wrote: thefile = params[upfile.file] if os.path.getsize(thefile) = conf[upmax]: print File Size Okay. #Add Functions Later... else: print File Too Large. #Here, too. CGItb reported the following error: TypeError: coercing to Unicode: need string or buffer, instance

Re: Tricky Areas in Python

2005-10-24 Thread Kent Johnson
Steven D'Aprano wrote: Alex Martelli wrote: Those two are easy. However, and this is where I show my hard-won ignorance, and admit that I don't see the problem with the property examples: class Base(object) def getFoo(self): ... def setFoo(self): ... foo =

Re: High Order Messages in Python

2005-10-24 Thread Kent Johnson
[EMAIL PROTECTED] wrote: counting that out(regardless whether it is (dis)advantage or not), what else a block can do but not a named function ? My limited understanding is that the advantage is - simpler syntax - high level of integration into the standard library (*many* methods that take

Re: IDE recommendation please

2005-10-24 Thread microsnot
Fast install: just go to the update manager (inside the help menu) and add update site: http://pydev.sf.net/updates/ (eclipse should do the rest) Too easy! Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: High Order Messages in Python

2005-10-24 Thread [EMAIL PROTECTED]
thanks. Seems that my programs are very simple and don't need these feature yet. Kent Johnson wrote: [EMAIL PROTECTED] wrote: counting that out(regardless whether it is (dis)advantage or not), what else a block can do but not a named function ? My limited understanding is that the

Re: Microsoft Hatred FAQ

2005-10-24 Thread Antoon Pardon
Op 2005-10-23, David Schwartz schreef [EMAIL PROTECTED]: Roedy Green [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 22 Oct 2005 16:10:24 -0700, David Schwartz [EMAIL PROTECTED] wrote or quoted : If the deal didn't give you more than it cost you, all you had to do

Re: Embedded Python - Sharing memory among scripts, threads

2005-10-24 Thread adsheehan
Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-24 Thread Fredrik Lundh
Steven D'Aprano wrote: Those two are easy. However, and this is where I show my hard-won ignorance, and admit that I don't see the problem with the property examples: class Base(object) def getFoo(self): ... def setFoo(self): ... foo = property(getFoo, setFoo)

Re: [OT] Python vs Ruby

2005-10-24 Thread Scott David Daniels
bruno modulix wrote: Scott David Daniels wrote: bruno modulix wrote: ... Another language that failed to make it to the mainstream but is worth giving a try is Smalltalk - the father of OOPLs (Simula being the GrandFather). I would say Simula is the forefather of modern OOPLs, and Smalltalk is

ABOUT FIND

2005-10-24 Thread Shi Mu
I got confused by the following information from the help for FIND: find(s, *args) find(s, sub [,start [,end]]) - in what does *args mean (especially the '*')? also, in the sub, why put a comma before start? what does 'in' mean? -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE recommendation please

2005-10-24 Thread microsnot
Just look in the archives of the Pythonmac mailinglist. We have discussed this very subject intensively recently, with a pretty extensive review of the different IDEs available. Looking through the mailing list. Any specific subject/dates I should be looking for? Suggestions for plugins for

Re: IDE recommendation please

2005-10-24 Thread microsnot
Mac users of SPE collected money for me to buy a Mac. This means that in the near future SPE will be especially improved for Mac. So feedback from Mac users is more than welcome and will probably be taken into account. SPE is a free, open source IDE with a lot of features like a debugger, UML

Re: ABOUT FIND

2005-10-24 Thread Fredrik Lundh
Shi Mu wrote: I got confused by the following information from the help for FIND: find(s, *args) what FIND ? help(str.find) Help on method_descriptor: find(...) S.find(sub [,start [,end]]) - int Return the lowest index in S where substring sub is found, such that sub is

Re: Would there be support for a more general cmp/__cmp__

2005-10-24 Thread Steve Holden
Antoon Pardon wrote: Op 2005-10-21, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: It would be better if cmp would give an indication it can't compare two objects instead of giving incorrect and inconsistent results. If two objects aren't totally comparable, then using

Re: Redirect os.system output

2005-10-24 Thread jas
Any other ideas? or examples of using subprocess to do what I was asking? Kent Johnson wrote: jas wrote: I would like to redirect the output from os.system to a variable, but am having trouble. I tried using os.popen(..).read() ...but that doesn't give me exactly what i want. Here is

Re: New User

2005-10-24 Thread Steve Holden
thatchmatic wrote: I just downloaded and I think installed python. I am not sure if I did cause it does'nt respond to the commands that the read me file told me to use. Also can someone suggest a trial program I can maybe write for fun? Thanks. 1:

Re: Python vs Ruby

2005-10-24 Thread Michele Simionato
Alex Martelli wrote: ... remember Pascal's Lettres Provinciales, and the famous apology about I am sorry that this letter is so long, but I did not have the time to write a shorter one!-) This observation applies to code too. I usually spend most of my time in making short programs that would

Re: output from external commands

2005-10-24 Thread Kent Johnson
darren kirby wrote: quoth the James Colannino: So, for example, in Perl I could do something like: @files = `ls`; So I guess I'm looking for something similiar to the backticks in Perl. Forgive me if I've asked something that's a bit basic for this list. Any help would be greatly appreciated :)

Re: [OT] Python vs Ruby

2005-10-24 Thread Neil Hodgson
Scott David Daniels: Sorry, I was being too cute by half. If Simula is the fore father (4 away) then Smalltalk is half as far (2) away. Hence the toofather. Toofather by analogy with the homophones fore and four we use the homophones two and too. We could smear the homophones further

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread Peter Hansen
[EMAIL PROTECTED] wrote: thanks, that is basically what I am doing and since it is a recipe, I would assume there is no standard library module for it. Well, since a Google search for site:docs.python.org subnet turns up nothing, one would assume not, but it would be hard to prove it without

Small utility program for the windows

2005-10-24 Thread Iyer, Prasad C
Hi, I am trying to create a small utility program which would be configured in registry. Something like this Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\ShortCut\command] @=\python C:\\workspace\\python\\Tut\\ShortCut.py\ It gives me access denied exception when I try it.

Re: Would there be support for a more general cmp/__cmp__

2005-10-24 Thread Antoon Pardon
Op 2005-10-24, Steve Holden schreef [EMAIL PROTECTED]: Antoon Pardon wrote: set([1]) = set([2]) False set([2]) = set([1]) False Set orderingd are explicitly documented as being based on proper subsetting. This is an abuse of the operators to make subset tests more convenient

[ANN] Python API InformixDB-2.0 released

2005-10-24 Thread Carsten Haese
Hi everybody, Thanks to significant code contributions by Daniel Smertnig, I am proud to announce release 2.0 of the Informix implementation of the Python DB-API, a mere 5 weeks after release 1.5. Downloads and info at http://informixdb.sourceforge.net/ This release features the following

Print in PythonWin

2005-10-24 Thread Shi Mu
In the PythonWin's interactive window, why sometimes I need type the command two times to make it work? for example, I execute print testList two times to make it work. Why? print testList print testList ['w', 'e', ' ', 'w', 'a', 'n', 't', ' ', 't', 'o', ' ', 'l', 'e', 'a', 'r', 'n', ' ', 'p',

Re: Redirect os.system output

2005-10-24 Thread jas
I see that, although I don't totall grasp the code. However, I am looking to basically emulate a command prompt. i.e. everything u see in the windows command prompt should be displayed back in python. How can I do it without files? Kent Johnson wrote: jas wrote: Any other ideas? or examples

Re: Microsoft Hatred FAQ

2005-10-24 Thread axel
In comp.lang.perl.misc David Schwartz [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In comp.lang.perl.misc David Schwartz [EMAIL PROTECTED] wrote: Mike Meyer [EMAIL PROTECTED] wrote in message Sorry, but nobody but the government actually owns

Re: Would there be support for a more general cmp/__cmp__

2005-10-24 Thread Steven D'Aprano
On Mon, 24 Oct 2005 09:23:58 +, Antoon Pardon wrote: Op 2005-10-21, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: It would be better if cmp would give an indication it can't compare two objects instead of giving incorrect and inconsistent results. If two objects

difference after remove

2005-10-24 Thread Shi Mu
Is there any difference if I remove the '/' from the following statement? intMatrix2 = [[1,1,2,4,1,7,1,7,6,9],\ [1,2,5,3,9,1,1,1,9,1],\ [0,0,5,1,1,1,9,7,7,7]] print intMatrix2 I removed one '\' and it still works. So what is the use of '\'? --

Re: Redirect os.system output

2005-10-24 Thread jas
Ok, I tried this... C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import subprocess as sp p = sp.Popen(cmd, stdout=sp.PIPE) result = p.communicate(ipconfig) 'result' is not recognized as

Re: How to separate directory list and file list?

2005-10-24 Thread Gonnasi
Lots of thanks for your help, My code can return the right result now. Thanks again! On Sun, 23 Oct 2005 17:27:49 +0200, Fredrik Lundh [EMAIL PROTECTED] wrote: Gonnasi wrote: With glob.glob(*) or os.listdir(cwd) I can get a combined file list with directory list, but I just wanna a

Turn $6 Into 15, 000.oo In 30 Days Or Less Using Paypal 100% Legal!!! Noreply

2005-10-24 Thread dreamer
It Will Work… If you do as I have done! Just Do It! follow the 4 steps… $6.00 to $15,000.00 in 30 days! Steps: Follow the Logic, Just Do it and It will work… $$$ in 4 easy steps… 1. Set Up a Free Paypal Account. 2. Send $1.00 to six Email Accounts from your Paypal Account 3. Delete email address

Re: Redirect os.system output

2005-10-24 Thread Kent Johnson
jas wrote: Any other ideas? or examples of using subprocess to do what I was asking? Actually I thought I was giving an example of what you were asking: - on windows - send a series of commands to a command process - capture the result to a variable The example I referenced sends a series of

Re: Microsoft Hatred FAQ

2005-10-24 Thread Roedy Green
On Mon, 24 Oct 2005 12:35:13 GMT, [EMAIL PROTECTED] wrote, quoted or indirectly quoted someone who said : I see that you cannot make a reasoned argument against the fact that property in the form of houses is taxed in America. And what has his inability to do that to your satisfaction got to do

Re: Microsoft Hatred FAQ

2005-10-24 Thread axel
In comp.lang.perl.misc David Schwartz [EMAIL PROTECTED] wrote: This is about whether we're talking *ABOUT* America, you idiot. It's as if he said the press has no freedom, and I replied, if you want to talk about some country where that's true, fine, but this discussion presumed

Re: Redirect os.system output

2005-10-24 Thread Steve Holden
jas wrote: Ok, I tried this... C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import subprocess as sp p = sp.Popen(cmd, stdout=sp.PIPE) result = p.communicate(ipconfig) 'result' is

Re: Would there be support for a more general cmp/__cmp__

2005-10-24 Thread Antoon Pardon
Op 2005-10-24, Steven D'Aprano schreef [EMAIL PROTECTED]: On Mon, 24 Oct 2005 09:23:58 +, Antoon Pardon wrote: Op 2005-10-21, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: It would be better if cmp would give an indication it can't compare two objects instead of

Re: difference after remove

2005-10-24 Thread Christoph Haas
On Monday 24 October 2005 15:02, Shi Mu wrote: Is there any difference if I remove the '/' from the following statement? You probably mean '\' instead of '/'. intMatrix2 = [[1,1,2,4,1,7,1,7,6,9],\ [1,2,5,3,9,1,1,1,9,1],\ [0,0,5,1,1,1,9,7,7,7]] print intMatrix2 I

Re: difference after remove

2005-10-24 Thread Steve Holden
Shi Mu wrote: Is there any difference if I remove the '/' \ from the following statement? intMatrix2 = [[1,1,2,4,1,7,1,7,6,9],\ [1,2,5,3,9,1,1,1,9,1],\ [0,0,5,1,1,1,9,7,7,7]] print intMatrix2 I removed one '\' and it

more than 100 capturing groups in a regex

2005-10-24 Thread Joerg Schuster
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: fl get rid of this limitation! if p.pattern.groups 100: raise AssertionError( sorry, but this version only supports 100

Re: Redirect os.system output

2005-10-24 Thread jas
doesn't sound to encouraging :) How about something with os.popen? in = os.popen(cmd, w) in.write(hostname) I tried this, and I get IOError: [Errno 22] Invalid Argument I am not sure why this isnt working. Steve Holden wrote: jas wrote: Ok, I tried this... C:\python Python 2.4.1

Re: write a loopin one line; process file paths

2005-10-24 Thread John Thingstad
On Wed, 19 Oct 2005 11:48:01 +0200, Xah Lee [EMAIL PROTECTED] wrote: Thanks a lot for various notes. Bonono? I will have to look at the itertools module. Just went to the doc http://www.python.org/doc/2.4.1/lib/module-itertools.html looks interesting. But I believe Python is designed for

Re: write a loopin one line; process file paths

2005-10-24 Thread Graham Fawcett
Xah Lee wrote: Dear Peter Hansen, My messages speak themselfs. You and your cohorts's stamping of it does not change its nature. And if this is done with repetitiousness, it gives away your nature. Taunt not the cohorts of Peter Hansen! Graham --

Re: newbie question about SocketServer

2005-10-24 Thread [EMAIL PROTECTED]
After further playing - it seems that the server_close() just takes time to execute. I have found that if I wait a while (1-3 seconds) the second connection will fail as well. Locking is already built into my handler class - so I'll just use it to prevent further connections until server_close()

Re: output from external commands

2005-10-24 Thread Mike Meyer
darren kirby [EMAIL PROTECTED] writes: If all you want is filenames this will work: import glob files = [%s % f for f in glob.glob(*)] What's the point of doing %s % f? How is this different from just file = [f for f in glob.glob(*)]? mike -- Mike Meyer [EMAIL PROTECTED]

Re: Execute C code through Python

2005-10-24 Thread Ernesto
Fredrik Lundh wrote: Ernesto wrote: Thanks. Can anyone provide an example of using *subprocess* to run helloWorld.C through the python interpreter. compile helloWorld, and run: import subprocess subprocess.call(helloWorld) (any special reason why you couldn't figure this out

Read/Write from/to a process

2005-10-24 Thread jas
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen(cmd.exe, stdout=sp.PIPE) p.stdin.write(hostname\n) however, it doesn't seem to work. I think the cmd.exe is catching it. I also tried f =

importing pickle modlue execute the code twice ??

2005-10-24 Thread ychaouche
Hi ! i am having a strange experience with the pickle module. I use python2.4 and i really don't understand what is happening on ! take a look at this : code import pickle print hello /code trace hello hello /trace code #import pickle print hello /code trace hello /trace I just don't get it.

Re: Set an environment variable

2005-10-24 Thread Grant Edwards
On 2005-10-24, Eric Brunel [EMAIL PROTECTED] wrote: The only think you can export an environment variable to is a child process Well, you know that, and I know that too. From my experience, many people don't... True. Using Unix for 20+ years probably warps one's perception of what's

Python/Apache Oddness On OSX

2005-10-24 Thread John Abel
Hi, I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI scripts using the builtin Apache. For ease, I've symlinked my custom modules into the /Library/Python/2.3/site-packages directory, and they import OK via command line python. However, when I perform the import from a

Re: Execute C code through Python

2005-10-24 Thread Fredrik Lundh
Ernesto wrote: Thanks. Can anyone provide an example of using *subprocess* to run helloWorld.C through the python interpreter. compile helloWorld, and run: import subprocess subprocess.call(helloWorld) (any special reason why you couldn't figure this out yourself, given the

Re: importing pickle modlue execute the code twice ??

2005-10-24 Thread Fredrik Lundh
ychaouche wrote: i am having a strange experience with the pickle module. I use python2.4 and i really don't understand what is happening on ! take a look at this : code import pickle print hello /code trace hello hello /trace did you perhaps name your test program pickle.py ? /F

Re: High Order Messages in Python

2005-10-24 Thread Alex Martelli
Kent Johnson [EMAIL PROTECTED] wrote: ... For example to open a file and read from it uses two closures, one to wrap a block with the file open/close, one to iterate lines (from the pickaxe book): File.open(testfile) do |file| file.each_line { |line| puts line } end Good example --

Re: Microsoft Hatred FAQ

2005-10-24 Thread Terry Hancock
On Saturday 22 October 2005 05:44 pm, Tim Tyler wrote: Microsoft still comes in at number 2 - on: http://dmoz.org/Society/Issues/Business/Allegedly_Unethical_Firms/ Few companies are more despised than Microsoft. Wrong URL? No such list appears at that site, although it does link to several

Re: Tricky Areas in Python

2005-10-24 Thread Alex Martelli
Steven D'Aprano [EMAIL PROTECTED] wrote: ... my hard-won ignorance, and admit that I don't see the problem with the property examples: class Sic: def getFoo(self): ... def setFoo(self): ... foo = property(getFoo, setFoo) Sorry for skipping the 2nd

Re: Python vs Ruby

2005-10-24 Thread Alex Martelli
Michele Simionato [EMAIL PROTECTED] wrote: Alex Martelli wrote: ... remember Pascal's Lettres Provinciales, and the famous apology about I am sorry that this letter is so long, but I did not have the time to write a shorter one!-) This observation applies to code too. I usually spend

Re: more than 100 capturing groups in a regex

2005-10-24 Thread skip
Joerg Or is there a way to circumvent [capturing groups limitation]? Sure, submit a patch to SourceForge that removes the restriction. I've never come anywhere close to creating regular expressions that need to capture 100 groups even though I generate regular expressions from a higher-level

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread gry
There was just recently announced -- iplib-0.9: http://groups.google.com/group/comp.lang.python.announce/browse_frm/thread/e289a42714213fb1/ec53921d1545bf69#ec53921d1545bf69 It appears to be pure python and has facilities for dealing with netmasks. (v4 only). -- George --

Re: Microsoft Hatred FAQ

2005-10-24 Thread Terry Hancock
On Monday 24 October 2005 08:19 am, Roedy Green wrote: On Mon, 24 Oct 2005 12:35:13 GMT, [EMAIL PROTECTED] wrote, quoted or indirectly quoted someone who said : I see that you cannot make a reasoned argument against the fact that property in the form of houses is taxed in America. And

Re: Tricky Areas in Python

2005-10-24 Thread Steven Bethard
Alex Martelli wrote: class Base(object) def getFoo(self): ... def setFoo(self): ... foo = property(getFoo, setFoo) class Derived(Base): def getFoo(self): [snip] the solution, in Python 2.4 and earlier, is to use one extra level of indirection:

Re: Python vs Ruby

2005-10-24 Thread Michele Simionato
Alex Martelli: Michele Simionato: cutting off non-essential features (and you can discover that a feature is non essential only after having implemented it) This one is difficult if you have RELEASED the program with the feature you now want to remove, sigh. Yeah, but I used the wrong word

Re: Redirect os.system output

2005-10-24 Thread Kent Johnson
jas wrote: Ok, I tried this... C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import subprocess as sp p = sp.Popen(cmd, stdout=sp.PIPE) result = p.communicate(ipconfig) 'result' is

Re: Redirect os.system output

2005-10-24 Thread jas
Kent, Yes, your example does work. So did os.popen...however, the problem is specific to cmd.exe. Have you tried that yet? Thanks! Kent Johnson wrote: jas wrote: Ok, I tried this... C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type

Re: output from external commands

2005-10-24 Thread Peter Hansen
Mike Meyer wrote: darren kirby [EMAIL PROTECTED] writes: If all you want is filenames this will work: import glob files = [%s % f for f in glob.glob(*)] What's the point of doing %s % f? How is this different from just file = [f for f in glob.glob(*)]? Answering narrowly, the difference

Re: Python variables are bound to types when used?

2005-10-24 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: the page was written before the type/class unification in Python 2.2, at a time where the word type had a stricter meaning (referring to C- level types, not user-level classes). Gotcha. Thanks. That writeup is definitely on my required reading list for new Python

Re: Read/Write from/to a process

2005-10-24 Thread jas
Thanks, that is certainly a start. As you mentioned, the cd could is an issue. Perhaps checking to see if the line ends with is sufficient? Dennis Lee Bieber wrote: On 24 Oct 2005 07:20:42 -0700, jas [EMAIL PROTECTED] declaimed the following in comp.lang.python: Hi, I would like to

Re: Read/Write from/to a process

2005-10-24 Thread jas
actually, i can't check for only because if you a dir, a line can end with a but is not the end of the output jas wrote: Thanks, that is certainly a start. As you mentioned, the cd could is an issue. Perhaps checking to see if the line ends with is sufficient? Dennis Lee Bieber wrote:

Re: output from external commands

2005-10-24 Thread James Colannino
Kent Johnson wrote: import os files = os.listdir('.') Thanks, that's good to know. I still need to use os.popen() for a few things, but I'll be needing filenames also, so when I try to get filenames I'll use the above. James -- My blog: http://www.crazydrclaw.com/ My homepage:

Re: Read/Write from/to a process

2005-10-24 Thread jas
What about having a thread which reads from subprocess.Popen()'s stdout...instead of read/write, read/write. just always read, and write when needed? any comments on that idea? jas wrote: actually, i can't check for only because if you a dir, a line can end with a but is not the end of the

Re: Tricky Areas in Python

2005-10-24 Thread beza1e1
let me try. 1) ''.join(lots_of_pieces) 2) This doesn't even work, if something is removed, the list is too short. So: [x for x in somelist if not isbad(x)] well, list comprehension is Python 2.4 and 2.3 is the standard in many OSes, so it is possibly not the most portable solution I had to look

Re: python gc performance in large apps

2005-10-24 Thread Chris Lambacher
A couple of strategic gc.collect() calls can be useful. You can also tweak how the garbage collector gets run by changing settings in the gc module. -Chris On Fri, Oct 21, 2005 at 04:13:09PM -0400, Robby Dermody wrote: Hey guys (thus begins a book of a post :), I'm in the process of

Extention String returning

2005-10-24 Thread Tuvas
I have been writing a program that is designed to return an 8 byte string from C to Python. Occasionally one or more of these bytes will be null, but the size of it will always be known. How can I write an extention module that will return the correct bytes, and not just until the null? I would

Re: Extention String returning

2005-10-24 Thread jepler
I think that you want to use return PyString_FromStringAndSize(buf, 8); Jeff pgp3nNxegNjmk.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Extention String returning

2005-10-24 Thread Jp Calderone
On 24 Oct 2005 11:28:23 -0700, Tuvas [EMAIL PROTECTED] wrote: I have been writing a program that is designed to return an 8 byte string from C to Python. Occasionally one or more of these bytes will be null, but the size of it will always be known. How can I write an extention module that will

Re: Extention String returning

2005-10-24 Thread Fredrik Lundh
Tuvas wrote: I have been writing a program that is designed to return an 8 byte string from C to Python. Occasionally one or more of these bytes will be null, but the size of it will always be known. How can I write an extention module that will return the correct bytes, and not just until

  1   2   >