Re: Running programs under a python program...

2008-05-21 Thread inhahe
maybe you could instead of killing the program stop the loop that starts new processes and start one that runs until the last process ends? also, if you killed the program but stdout was still set to fd and stderr was still set to subprocesses.STDOUT, what would happen when those two objects d

xpath with big files

2008-05-21 Thread Vladimir Kropylev
Hi, I've encountered a problem when trying to use lxml.etree.xpath with big (63Mb) file. It returns empty list on any request. Is there any restriction on file size for lxml.etree.xpath? This is what I do: f=open(filename) tree = etree.parse(f) f.close() r = tree.xpath('//image') print(r) it pri

Re: What is wrong with my Python threading?

2008-05-21 Thread Chuckk Hubbard
On Tue, May 20, 2008 at 4:28 PM, castironpi <[EMAIL PROTECTED]> wrote: > On May 20, 8:19 am, "Chuckk Hubbard" <[EMAIL PROTECTED]> > wrote: >> #!/usr/bin/python >> >> #why doesn't this run both threads simultaneously? >> #Thanks for any help. >> #Chuckk >> >> import threading >> import time >> >> de

Re: Processing in Python

2008-05-21 Thread Salvatore DI DI0
> He meant it has been re-implemented in Javascript: Indeed :-) There is a jython based NodeBox that runs on windows that can be found > here: > > http://research.nodebox.net/index.php/NodeBoxDev > Thank you -- http://mail.python.org/mailman/listinfo/python-list

getting dir(x), but not as list of strings?

2008-05-21 Thread mh
I want to iterate over members of a module, something like: for i in dir(x): if type(i) == types.FunctionType: ... but of course dir() returns a list of strings. If x is a module, how can I get the list of its members as their actual types? Many TIA! Mark -- Mark Harrison Pixar An

Re: Processing in Python

2008-05-21 Thread Salvatore DI DI0
Thanks all of you Regards Salvatore -- http://mail.python.org/mailman/listinfo/python-list

Re: getting dir(x), but not as list of strings?

2008-05-21 Thread Marc 'BlackJack' Rintsch
On Wed, 21 May 2008 07:54:32 +, mh wrote: > I want to iterate over members of a module, something like: > > for i in dir(x): > if type(i) == types.FunctionType: ... > > but of course dir() returns a list of strings. If x is a module, > how can I get the list of its members as th

HTMLParser error

2008-05-21 Thread jonbutler88
Just writing a simple website spider in python, keep getting these errors, not sure what to do. The problem seems to be in the feed() function of htmlparser. Traceback (most recent call last): File "spider.py", line 38, in s.crawl(site) File "spider.py", line 30, in crawl self.parse(u

Re: iterate start at second row in file not first

2008-05-21 Thread Chris
On May 20, 8:34 pm, [EMAIL PROTECTED] wrote: > i have a big file with sentences, the first file of each sentence > contains a colon(:) somewher eon that line > i want to jump past that sentence. > > if all(x != ':' for x in line): > > this way i can check but i dont want to check for every line in

Typeerror

2008-05-21 Thread Beema shafreen
Hi all, I getting the following error when i run my scirpt , can somebody help me regarding this to solve the type error problem Traceback (most recent call last): File "get_one_prt_pep.py", line 59, in ? if len(data[res])<=1: TypeError: string indices must be integers -- Beema Shafreen

Print HTML from Python

2008-05-21 Thread Jorgen Bodde
Hi All, I am at a loss. This is slightly OT because it concerns Windows and HTML printing. I would like to print a HTML document from Python, but not showing the printing dialog. After numerous searches and trials I came to the conclusion that ShellExecute with the "print" command and a HTML docum

Re: Typeerror

2008-05-21 Thread Freaky Chris
This is a simple error, you are passing the variable res as an interger to use for a slice when what ever you are storing in res isn't an integer. Chris Beema shafreen wrote: > > Hi all, > I getting the following error when i run my scirpt , > can somebody help me regarding this to solve the ty

Re: scalable xml

2008-05-21 Thread Diez B. Roggisch
hyperboreean wrote: > Hi, I am writing the application server for a three-tier architecture > and sending the client's response in xml. My question is: is there a way > to build the xml dom in a more scalable way and faster way than just > creating every textNode and element for it? I have tons of

Re: Python in non-standard location erring with "No module named _sha256"

2008-05-21 Thread Laurent Rahuel
Maybe you run the configure, make, make install without addind devel packages on your system. I mean: openssl-devel readline-devel ... Regards, emallove wrote: > I'm running into the below "No modules named _sha256" issue, with a > python installed in a non-standard location. > > $ python > Py

Re: Typeerror

2008-05-21 Thread Beema shafreen
Thanks a lot i had solved the problem On Wed, May 21, 2008 at 2:32 PM, <[EMAIL PROTECTED]> wrote: > On May 21, 9:58 am, Freaky Chris <[EMAIL PROTECTED]> wrote: > > This is a simple error, you are passing the variable res as an interger > to > > use for a slice when what ever you are storing in re

scalable xml

2008-05-21 Thread hyperboreean
Hi, I am writing the application server for a three-tier architecture and sending the client's response in xml. My question is: is there a way to build the xml dom in a more scalable way and faster way than just creating every textNode and element for it? I have tons of data to transmit and it

How to transfer files over serial?

2008-05-21 Thread RaymondHe
I want to transfer files over serial,but PySerial Module does not support any protocol such as xmodem/ymodem,and I find nothing about these protocol write in python What should I do?Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Typeerror

2008-05-21 Thread jonbutler88
On May 21, 9:58 am, Freaky Chris <[EMAIL PROTECTED]> wrote: > This is a simple error, you are passing the variable res as an interger to > use for a slice when what ever you are storing in res isn't an integer. > > Chris > > > > Beema shafreen wrote: > > > Hi all, > > I getting the following error

Re: HTMLParser error

2008-05-21 Thread jonbutler88
On May 21, 9:53 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 21 May 2008 01:18:00 -0700 (PDT), [EMAIL PROTECTED] > declaimed the following in comp.lang.python: > > > Any ideas of how to fix this? Im using python 2.5.2 on mac osx > >         In the absence of minimal runable code repro

C-like assignment expression?

2008-05-21 Thread boblatest
Hello, I have an if-elif chain in which I'd like to match a string against several regular expressions. Also I'd like to use the match groups within the respective elif... block. The C-like idiom that I would like to use is this: if (match = my_re1.match(line): # use match elsif (match = my_re2

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > I have an if-elif chain in which I'd like to match a string against > several regular expressions. Also I'd like to use the match groups > within the respective elif... block. The C-like idiom that I would > like to use is this: > > if (match = my_re1.match(

Publish a program

2008-05-21 Thread TheSaint
Hello, I'm not a master of python :) If I would publish my program for reviewing, where should I upload it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-21 Thread Bruno Desthuilliers
Roel Schroeven a écrit : Wow this resulted in far more reactions than I had expected ... [EMAIL PROTECTED] schreef: On 19 mai, 15:30, Roel Schroeven <[EMAIL PROTECTED]> wrote: Bruno Desthuilliers schreef: 1/ being interpreted or compiled (for whatever definition of these terms) is not a prop

Re: Using Python for programming algorithms

2008-05-21 Thread Bruno Desthuilliers
sturlamolden a écrit : On May 19, 10:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Well... They do - they are called 'C compilers' !-) As Roel Schroven mentioned - and he is at least partially right on this point - C has been designed to make optimizing C compiler not to hairy to write.

Re: HTMLParser error

2008-05-21 Thread alex23
On May 21, 6:58 pm, [EMAIL PROTECTED] wrote: > Its not a variable I set, its one of HTMLParser's inbuilt variables. I > am using it with urlopen to get the source of a website and feed it to > htmlparser. > > def parse(self, page): > try: > self.feed(urlopen('http://' + page).re

Re: HTMLParser error

2008-05-21 Thread alex23
On May 21, 8:04 pm, alex23 <[EMAIL PROTECTED]> wrote: > Is your Spider class a subclass of HTMLParser? Is it over-riding > __init__? If so, is it doing something like: > > super(Spider, self).__init__() > > If this is your issue[...] I'm sorry, this really wasn't clear at all. What I meant was

Re: Using Python for programming algorithms

2008-05-21 Thread Frédéric Degraeve
> By the way, is it possible (and easy) to call a C function from a > Python program?? Use SWIG. It's easy, smart and beautiful. After that, you can call C/C+ + from a lot of scripting languages such as python, R, etc A lot of open sources projects already use it. http://www.swig.org/tutorial.ht

Re: Publish a program

2008-05-21 Thread alex23
On May 21, 7:52 pm, TheSaint <[EMAIL PROTECTED]> wrote: > Hello, > > I'm not a master of python :) If I would publish my program for reviewing, > where should I upload it? For simple "look at my code" I like http://paste.turbogears.org/ Sample: http://paste.turbogears.org/paste/2697 There's also

Re: Using Python for programming algorithms

2008-05-21 Thread Frédéric Degraeve
I reply to myself! > > Boost.Python is also very known (but never tested by myself). > http://www.boost.org/doc/libs/1_35_0/libs/python/doc/tutorial/doc/html/index.html here the example. I know that it has been made to simplify the CPython's use and this is based on CPython. Frédéric -- http://m

Re: C-like assignment expression?

2008-05-21 Thread Ulrich Eckhardt
[EMAIL PROTECTED] wrote: > I have an if-elif chain in which I'd like to match a string against > several regular expressions. Also I'd like to use the match groups > within the respective elif... block. The C-like idiom that I would > like to use is this: > > if (match = my_re1.match(line): > #

Minimal Python installation?

2008-05-21 Thread Thomas Troeger
Hi, I'd like to put the python library and interpreter on a small embedded Linux x86 compatible device where disk space is an issue. I played around with the minimal Python interpreters, but was not entirely happy with them, so my question is, is there an (preferably easy) way to put the inte

Database Query Contains Old Data

2008-05-21 Thread giraffeboy
Hi there, I'm having a problem with the Python db api, using MySQL. I've written a program with a GUI using wxPython, the GUI is contained in main.py which imports another module - reports.py. There are several reports that are selected using the gui, and each report is a class in the file report

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Alan Wright
Thanks Roy Any ideas how to code this child process stuff, as I said I am newbie and not from a coding background to be honest ideally yes, i'd get 50K, but if i can get above 30K that would be OK Alan "Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMA

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Alan Wright
Same on FC8, sends RST after it sees SYN/ACK "Ghirai" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 19 May 2008 23:50:50 +0100 > "Alan Wright" <[EMAIL PROTECTED]> wrote: > >> Ghirai, >> Scapy does the same, only it sends RST and not FIN, so still no help >> >> send(IP(dst

Re: getting dir(x), but not as list of strings?

2008-05-21 Thread akeppke
Use for i in dir(x): print i# name of member as string print getattr(x, i)# member regards Arno On 21 Mai, 09:54, [EMAIL PROTECTED] wrote: > I want to iterate over members of a module, something like: > > for i in dir(x): > if type(i) ==

Re: Organizing a Python project

2008-05-21 Thread Casey McGinty
> I'm starting work on what is going to become a fairly substantial > Python project, and I'm trying to find the best way to organize > everything. I'd like to add a follow up question. Are there any idioms for writing /usr/bin scripts to run installed package modules? For this I am assuming a s

Re: "indexed properties"...

2008-05-21 Thread pataphor
On Tue, 20 May 2008 10:40:17 -0500 "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > > > Today's little joke: Long ago I would have solved > > > this by storing the data as a list of rows and _also_ > > > a list of columns, updating each one any time the > > > other changed. Just goes to show you th

Re: C-like assignment expression?

2008-05-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Hello, I have an if-elif chain in which I'd like to match a string against several regular expressions. Also I'd like to use the match groups within the respective elif... block. The C-like idiom that I would like to use is this: if (match = my_re1.match(line): # u

Re: Code/test ratio wrt static vs dynamic typing

2008-05-21 Thread Bruno Desthuilliers
Ben Finney a écrit : greg <[EMAIL PROTECTED]> writes: Also, I don't think it's valid to equate the size of the tests with the amount of effort it took to develop them. For instance, the test suite for Pyrex is currently larger than the Pyrex compiler, but I've still spent far more time and effo

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : En Sun, 18 May 2008 17:31:44 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: Agustin Villena schrieb: is there anyway to show the class of a method in an exception's traceback? I want to improve the line File "G:\dev\exceptions\sample.py", line 3, in foo t

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Richard G Riley
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Gabriel Genellina a écrit : >> En Sun, 18 May 2008 17:31:44 -0300, Diez B. Roggisch >> <[EMAIL PROTECTED]> escribió: >>> Agustin Villena schrieb: >> is there anyway to show the class of a method in an exception's traceback? I wa

Re: Minimal Python installation?

2008-05-21 Thread Paul Boddie
On 21 Mai, 12:07, Thomas Troeger <[EMAIL PROTECTED]> wrote: > > I'd like to put the python library and interpreter on a small embedded > Linux x86 compatible device where disk space is an issue. I played > around with the minimal Python interpreters, but was not entirely happy > with them, so my qu

Re: Misuse of list comprehensions?

2008-05-21 Thread Bruno Desthuilliers
Simon Forman a écrit : On May 20, 8:58 am, Paul McGuire <[EMAIL PROTECTED]> wrote: On May 20, 10:50 am, [EMAIL PROTECTED] wrote: You don't need all those conditionals. A set differs from a list precisely in the fact that each element is unique. And since the function is expecting "s" to be a

problem with import / namespace

2008-05-21 Thread ohad frand
Hi I have a problem that the solution to it must be very simple but i couldnt fint it's answer in the internet so far (i searched for couple of days) the problme is as follows: i have two directories e.g. "\\1" and "\\2" in each directory i have two files with the same names e.g. "tmp1.py" and "tm

Re: How to transfer files over serial?

2008-05-21 Thread zerge69
On May 21, 4:07 am, RaymondHe <[EMAIL PROTECTED]> wrote: > I want to transfer files over serial,but PySerial Module does not > support any protocol such as xmodem/ymodem,and I find nothing about > these protocol write in python > > What should I do?Thank you Does it have to be over the serial? If

Re: C-like assignment expression?

2008-05-21 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > The canonical solution is to iterate over a list of > expression,function pairs, ie: Although that solution is pretty, it is not the canonical solution because it doesn't cover the important case of "if" bodies needing to access common variables i

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread John Machin
Robert Kern wrote: Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed -- for example, an int

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Alan Wright" <[EMAIL PROTECTED]> wrote: > Thanks Roy > > Any ideas how to code this child process stuff, as I said I am newbie and > not from a coding background The easiest thing would be to use os.system(). If you wanted to spawn 10 child processes, you cou

qrcode in python?

2008-05-21 Thread Michel Albert
I am planning to write a python-module for python as I haven't found anything on the tubes so far. If anyone has any interesting insight on this topic, replies are welcome! ;) Q: What is QR-Code? A: http://www.denso-wave.com/qrcode/qrstandard-e.html So far (as of May 21st 2008): Google (1 sensi

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread Matthieu Brucher
> > This is all true if you want to operate in "native" mode; however in > "standard" mode the sizes are fixed -- otherwise there'd be no easy way of > reading/writing the fixed-size fields in many common file formats. > > As the manual says: > """ > Native size and alignment are determined using t

about python modules

2008-05-21 Thread srinivas
hi friends i am new to python programming. i am using Python 2.5 and IDLE as editor. i have developed some functions in python those will be calling frequently in my main method . now i want to know how to import my functions folder to python in sucha way that the functions in functions folder shou

Re: Running commands on cisco routers using python

2008-05-21 Thread James Harris
On 19 May, 16:18, SPJ <[EMAIL PROTECTED]> wrote: > Is it possible to run specific commands on cisco router using Python? > I have to run command "show access-list" on few hundred cisco routers and get > the dump into a file. Please let me know if it is feasible and the best way > to achieve this.

Re: about python modules

2008-05-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, srinivas <[EMAIL PROTECTED]> wrote: > hi friends i am new to python programming. > i am using Python 2.5 and IDLE as editor. > i have developed some functions in python those will be calling > frequently in my main method . > now i want to know how to import my fu

Re: Misuse of list comprehensions?

2008-05-21 Thread cokofreedom
''.join(seen.add(c) or c for c in s if c not in seen) >From what I can understand... .join will be a String of unique 'c' values. 'seen.add(c) or c' will always point to the second statement 'c' because seen.add(c) returns None. 'if c not in seen' will ensure 'c' being added to both the .join a

Re: about python modules

2008-05-21 Thread bockman
On 21 Mag, 14:31, srinivas <[EMAIL PROTECTED]> wrote: > hi friends i am new to python programming. > i am using Python 2.5 and IDLE as editor. > i have developed some functions in python those will be calling > frequently in my main method . > now i want to know how to import my functions folder to

Re: Database Query Contains Old Data

2008-05-21 Thread Jerry Hill
On Wed, May 21, 2008 at 6:30 AM, <[EMAIL PROTECTED]> wrote: > The first time you run a report, everything works as expected but if > you run it a second time, after modifying data, it seems that the data > from before the modification is selected on the second report run. Did you remember to comm

Re: C-like assignment expression?

2008-05-21 Thread [EMAIL PROTECTED]
On May 21, 1:47 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Although that solution is pretty, it is not the canonical solution > because it doesn't cover the important case of "if" bodies needing to > access common variables in the enclosing scope. (This will be easier > in Python 3 with 'nonl

Re: Database Query Contains Old Data

2008-05-21 Thread giraffeboy
On May 21, 1:49 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > Did you remember to commit your changes before re-running the report? > Python's DB API requires that any auto-commit feature of the > underlying database be turned off by default, so you are required to > commit changes yourself. If y

Re: Print HTML from Python

2008-05-21 Thread Mike Driscoll
On May 21, 3:45 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi All, > > I am at a loss. This is slightly OT because it concerns Windows and > HTML printing. I would like to print a HTML document from Python, but > not showing the printing dialog. After numerous searches and trials I > came to t

Re: C-like assignment expression?

2008-05-21 Thread cokofreedom
On May 21, 3:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 21, 1:47 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > > > Although that solution is pretty, it is not the canonical solution > > because it doesn't cover the important case of "if" bodies needing to > > access common vari

Re: Publish a program

2008-05-21 Thread TheSaint
On 18:15, mercoledì 21 maggio 2008 alex23 wrote: > On May 21, 7:52 pm, TheSaint <[EMAIL PROTECTED]> wrote: > There's also http://python.pastebin.com, which lets you create a new > paste by modifying an existing one, and keeps them linked for easy > diff'ing. > > Sample: http://python.pastebin.co

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 21, 1:47 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > >> Although that solution is pretty, it is not the canonical solution >> because it doesn't cover the important case of "if" bodies needing to >> access common variables in the enclosing scope. (This will b

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 21, 3:12 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> On May 21, 1:47 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >> >> > Although that solution is pretty, it is not the canonical solution >> > because it doesn't cover the important case of "if" bodies

Re: C-like assignment expression?

2008-05-21 Thread cokofreedom
> > And wastes time. regular expressions can become expensive to match - doing > it twice might be hurtful. > > Diez match = (my_re1.match(line) or my_re2.match(line)) or my_re3.match(line) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with import / namespace

2008-05-21 Thread Laszlo Nagy
ohad frand wrote: Hi I have a problem that the solution to it must be very simple but i couldnt fint it's answer in the internet so far (i searched for couple of days) the problme is as follows: i have two directories e.g. "\\1" and "\\2" in each directory i have two files with the same names

Re: Struct usage and varying sizes of h, l, etc

2008-05-21 Thread Grant Edwards
On 2008-05-20, Robert Kern <[EMAIL PROTECTED]> wrote: >> I'm looking at the struct module for binary packing of ints >> and floats. The documentation refers to C datatypes. It's >> been many years since I looked at C, but I seem to remember >> that the data type sizes were not fixed -- for examp

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> >> And wastes time. regular expressions can become expensive to match - >> doing it twice might be hurtful. >> >> Diez > > match = (my_re1.match(line) or my_re2.match(line)) or > my_re3.match(line) How do you know *which* of the three has matched then? Diez -- http:/

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Bruno Desthuilliers
Richard G Riley a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> writes: (snip) And not that useful - why would one care about the function being defined in class X or Y when one have the exact file and line ? Very obvious I would think. One can develop ones own interactive class browser a

Re: Database Query Contains Old Data

2008-05-21 Thread Paul Boddie
On 21 Mai, 15:22, [EMAIL PROTECTED] wrote: > > I did and I confirmed this by modifying the data, selecting it from > the mysql command line client to verify the changes, then running the > report again. If I exit the application and then start it again, > everything works as expected until the seco

Code For Five Threads To Process Multiple Files?

2008-05-21 Thread tdahsu
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should start five threads and process five files at a time. Is this a good idea? I picked the number five at ran

how to proccess the blank in the path on linux

2008-05-21 Thread zhf
I want ro walk a directory and its sub directory on linux, to find some shell script file, and run them, but I found some path belong blank charactor, such as '8000 dir', if I write as follow, I got error "no such file" path = '8000 dir' for root, dirs, files in os.walk(path): cmd = ' ' cmd = 'cd '

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Richard G Riley
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Richard G Riley a écrit : >> Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > (snip) > >>> And not that useful - why would one care about the function being >>> defined in class X or Y when one have the exact file and line ? >> >> Very obvious I

Re: C-like assignment expression?

2008-05-21 Thread cokofreedom
On May 21, 4:09 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >> And wastes time. regular expressions can become expensive to match - > >> doing it twice might be hurtful. > > >> Diez > > > match = (my_re1.match(line) or my_re2.match(line)) or > > my_re3.match(lin

Re: problem with import / namespace

2008-05-21 Thread Laszlo Nagy
When you try to import a module, python starts to search for it. The was it does the search is very well defined. It mostly depends on the current directory and sys.path. You can read more about this here: "The was it" -> "The way it" - inside your app.py file either make sure that the curre

Re: Showing the method's class in expection's traceback

2008-05-21 Thread Bruno Desthuilliers
Richard G Riley a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> writes: Richard G Riley a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> writes: (snip) And not that useful - why would one care about the function being defined in class X or Y when one have the exact file and line ? Very

Re: problem with import / namespace

2008-05-21 Thread ohad frand
Hi Thanks for the answer. I probably didnt write the problem accurately but it is not as you described. (i already read before the section that you pointed and it didnt help me) the problem is that i dont want to import a file from different directory but only from the same directory. \\1\tmp2.py i

Re: about python modules

2008-05-21 Thread inhahe
i always just put most of my python files in the c:\python25 directory. including ones i want to import as modules, since they import from there. otherwise you can put the file in c:\python25\lib\site-packages "srinivas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi friends i

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
> Personally (and borrowing from Python), I'd prefer something more > like: > > Write "Fa". > Repeat 8 times: > Write "-la". I actually kind of prefer that, too. Or Repeat 8 times write "-la". I'll think about it. Thank you for suggesting it. On May 20, 3:40 pm, MRAB <[EMAIL PROTECTED]> w

Re: C-like assignment expression?

2008-05-21 Thread inhahe
one of the few things i miss from C is being able to use assignment in expressions. that's the only thing, really. also there's no switch/case, you have to use a dictionary of functions instead, although i rarely need that, usually i just use elif. <[EMAIL PROTECTED]> wrote in message news:[E

Re: how to proccess the blank in the path on linux

2008-05-21 Thread A.T.Hofkamp
On 2008-05-21, zhf <[EMAIL PROTECTED]> wrote: > I want ro walk a directory and its sub directory on linux, > to find some shell script file, and run them, but I found some path belong > blank charactor, such as '8000 dir', if I write as follow, I got error > "no such file" > path = '8000 dir' > for

Re: C-like assignment expression?

2008-05-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On May 21, 4:09 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> >> >> And wastes time. regular expressions can become expensive to match - >> >> doing it twice might be hurtful. >> >> >> Diez >> >> > match = (my_re1.match(line) or my_re2.

Re: how to proccess the blank in the path on linux

2008-05-21 Thread Jeremy Sanders
A.T.Hofkamp wrote: > Escape the space to prevent the shell from interpreting it as a word > seperator. This of course also holds for all other shell meta characters, > such as * [ ] \ > < & and a few others I probably have forgotten. If the command was useful (unlike cd), it might be better to us

Re: Code For Five Threads To Process Multiple Files?

2008-05-21 Thread A.T.Hofkamp
On 2008-05-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'd appreciate any help. I've got a list of files in a directory, and > I'd like to iterate through that list and process each one. Rather > than do that serially, I was thinking I should start five threads and > process five files at

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
> Or just: > > If command is "quit" ... Hmmm. In Flaming Thunder, I'm using "is" (and "is an", "is a", etc) for assigning and checking types. For example, to read data from a file and check for errors: Read data from "input.txt". If data is an error then go to ... Or when assigning a

Re: compressing short strings?

2008-05-21 Thread inhahe
i don't see anybody mentioning huffman encoding. i think it just works per byte, so it's not as tight as gzip or whatever. but it sounds like it would be easy to implement and wouldn't require any corpus-wide compression information. except a character frequency count if you wanted to be optim

Re: C-like assignment expression?

2008-05-21 Thread cokofreedom
On May 21, 4:57 pm, "inhahe" <[EMAIL PROTECTED]> wrote: > one of the few things i miss from C is being able to use assignment in > expressions. that's the only thing, really. > also there's no switch/case, you have to use a dictionary of functions > instead, although i rarely need that, usually i

Re: Python and Flaming Thunder

2008-05-21 Thread Bruno Desthuilliers
Dave Parker a écrit : Or just: If command is "quit" ... Hmmm. In Flaming Thunder, I'm using "is" (and "is an", "is a", etc) for assigning and checking types. For example, to read data from a file and check for errors: Read data from "input.txt". If data is an error then go to ...

Re: C-like assignment expression?

2008-05-21 Thread Paul McGuire
On May 21, 9:09 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >> And wastes time. regular expressions can become expensive to match - > >> doing it twice might be hurtful. > > >> Diez > > > match = (my_re1.match(line) or my_re2.match(line)) or > > my_re3.match(lin

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
On May 20, 7:05 pm, Collin <[EMAIL PROTECTED]> wrote: > Personally, FT is a bit meh to me. The way you issue your statements I > always think something is wrong, mainly because when I want to define, > say, x, in python I'd go: > > x = "whatever" > > Instantly noting that I defined x. While in Fla

Possibly pydb 1.23 release around May 30

2008-05-21 Thread R. Bernstein
A release of pydb (1.23) is currently scheduled for around May 30th. If you can and want to help make sure the release is okay, you can try out what is currently in CVS: http://sourceforge.net/cvs/?group_id=61395 I've put an interim tar at http://bashdb.sf.net/pydb-1.23cvs.tar.gz Changes in

Re: C-like assignment expression?

2008-05-21 Thread Kay Schluehr
On 21 Mai, 11:38, [EMAIL PROTECTED] wrote: > Hello, > > I have an if-elif chain in which I'd like to match a string against > several regular expressions. Also I'd like to use the match groups > within the respective elif... block. The C-like idiom that I would > like to use is this: > > if (match

Re: getting dir(x), but not as list of strings?

2008-05-21 Thread Gary Herron
[EMAIL PROTECTED] wrote: I want to iterate over members of a module, something like: for i in dir(x): if type(i) == types.FunctionType: ... but of course dir() returns a list of strings. If x is a module, how can I get the list of its members as their actual types? Many TIA! Mark

Re: Code For Five Threads To Process Multiple Files?

2008-05-21 Thread tdahsu
On May 21, 11:13 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-05-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I'd appreciate any help.  I've got a list of files in a directory, and > > I'd like to iterate through that list and process each one.  Rather > > than do that serially,

Re: compressing short strings?

2008-05-21 Thread Paul Rubin
"inhahe" <[EMAIL PROTECTED]> writes: > i don't see anybody mentioning huffman encoding. i think it just works per > byte, so it's not as tight as gzip or whatever. but it sounds like it would > be easy to implement and wouldn't require any corpus-wide compression > information. except a charac

[ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
In an earlier post, I was interested in passing a pointer to a structure to fcntl.ioctl. This works: c = create_string_buffer (...) args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) err = fcntl.ioctl(eos_fd, request, args) Now to do the same with ctypes, I have one problem. c

issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
Okay so I'm writing a script in python right now as a dirty fix for a problem we're having at work.. Unfortunately this is the first really non-trivial script that I've had to work with in python and the book that I have on it really kind of sucks. I'm having an issue parsing lines of 'last' outp

Re: Python and Flaming Thunder

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 11:34 AM, Dave Parker <[EMAIL PROTECTED]> wrote: > For example, consider the two statements: > > x = 8 > x = 10 > > The reaction from most math teachers (and kids) was "one of those is > wrong because x can't equal 2 different things at the same time". Sounds to me

Re: C-like assignment expression?

2008-05-21 Thread inhahe
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 21, 4:57 pm, "inhahe" <[EMAIL PROTECTED]> wrote: >> one of the few things i miss from C is being able to use assignment in >> expressions. that's the only thing, really. >> also there's no switch/case, you have to use a dictio

Re: Python and Flaming Thunder

2008-05-21 Thread Dave Parker
On May 21, 10:00 am, "Dan Upton" <[EMAIL PROTECTED]> wrote: > Sounds to me like the teacher is being difficult, ... No, proof-by-contradiction is a common technique in math. If you can show that x=8 and x=10, then you have shown that your assumptions were incorrect. > If you can't do, or don't

Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
Okay, so I manged to kludge around the issue by not using the .readline() in my 'for' statement. Instead, I'm slurping the whole file into a new list that I put in for that purpose, and everything seems to be working just fine. However, I don't know WHY the other method failed and I'm at a loss f

  1   2   3   >