Re: Jython socket typecasting problems

2006-02-11 Thread Diez B. Roggisch
> This is the code section of my server class (I cut this from a Python > example): > def establishConnection(self): > self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > self.socket.connect((self.host, self.port)) > Do I have to use explicit typecasting? How can t

Re: Image to numeric array

2006-02-13 Thread Diez B. Roggisch
ble to do this with all types of image formats. It was suggested that > a function such as 'B = numeric.from_image(A)' was used but I can't find > it in any of the libraries. I was hoping you could help me on this. You have to install the numeric library for that. Googling nume

Re: Image to numeric array

2006-02-13 Thread Diez B. Roggisch
> Is there a difference between the 'Numeric' and 'numeric' module? > I have on my system only Numeric... And this has no function like > 'from_image'. I actually didn't check that - I just wanted to point the OP to the numeric-module(s) available, as he suggested that >The usual way of doing su

Re: 88k regex = RuntimeError

2006-02-14 Thread Diez B. Roggisch
> I assume it's hitting some limit, but don't know where the limit is to > remove it. I tried stepping into it repeatedly with Komodo, but didn't > see the problem. That's because it is buried in the C-library that is the actual implementation. There has been a discussion about this a few weeks ag

Re: low level data types

2006-02-15 Thread Diez B. Roggisch
dementrio wrote: > Thanks for the hint! > > However now I have another problem - endianness (the client runs on > powerpc, the server on x86). I found that simply reversing the stuff I > recv() works, but is there any cleaner way for taking care of this? Have you actually _read_ the struct docum

Re: Embedding a binary file in a python script

2006-02-15 Thread Diez B. Roggisch
mrstephengross wrote: > Ok, this is a neat idea... The uu module deals with files though, not > strings. Is there a way in python to make a string act like a file > handle? (c)?StringIO Diez -- http://mail.python.org/mailman/listinfo/python-list

Weekly Python Patch/Bug Summary

2006-02-15 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 399 open ( +8) / 3042 closed ( +4) / 3441 total (+12) Bugs: 923 open ( +8) / 5553 closed (+13) / 6476 total (+21) RFE : 209 open ( +0) / 198 closed ( +1) / 407 total ( +1) New / Reopened Patches __ urllib pr

Re: Visual Report Editor

2006-02-16 Thread Diez B. Roggisch
Pawel wrote: > Hello, > I plan to make Visual Reporting Editior, a new product for > corporate-class systems. Data will be in XML and in my application, > designer should be able to make fascinating templates of reports. I > will use Python and MSVS 2005 Pro. My question is, which libaries will >

Re: Some general questions about using "stdin","stdout"....

2006-02-16 Thread Diez B. Roggisch
asdsd sir wrote: > Hi!I'm new in Python and i'd like to ask some general questions about > stdin,stdout... > > Firstly... > > if we type like something like : >cat "file.txt"|python somefile.py > > #somefile.py > import sys > text=sys.stdin.read() > > > ...then "sys.stdin.read()"

Re: Terminating a function

2006-02-17 Thread Diez B. Roggisch
Astan Chee wrote: > Hi, > Im rather new to threads in python but Im trying to terminate a function > call (or the execution of the function) after a certain period of time > has passed. > Do i need to use threads with this? if i do, how do i go about doing it? Yes and no. As you didn't tell us mu

Re: Print a PDF transparently

2006-02-17 Thread Diez B. Roggisch
> Based on all this, I have been investigating about postscript files. I > realize that printers do handle this language, so I think if I have a > .ps file and send it directly to the printer, it should do the job, > right? (this is certainly a question) If the answer is True, no matter > in what p

Re: Checkbuttons in a Text widget

2006-02-17 Thread Diez B. Roggisch
Lou G wrote: > I'm trying to show a number of Checkbuttons (each with associated text > based on a list of names) inside a y-scrollable Text widget like so: > > [ ] Bob > [ ] Carol > [ ] Ted > [ ] Alice > etc. > etc. > > There may be quite a few (as many as 100 or so). I'm uncertain as to > the

Re: GDI in python>?

2006-02-18 Thread Diez B. Roggisch
al pacino schrieb: > hi, > > is it possible to address the 'screen pixels' using python , like > analogous to older dos( functions that graphics.h provides') or win api > calls for gdi. Use one of the available GUI-Toolkits - Tkinter is included already. Or pygame. Diez -- http://mail.python

Re: general coding issues - coding style...

2006-02-18 Thread Diez B. Roggisch
calmar schrieb: > Hi all, > > since I'm just a 'handicraft'/beginner or so, > > could anybody provide me with some (rough) hints, about how to enhance the > code > here: - why are these {{{ thingies there? - use string interpolation like "Foo %s %i" % ("bar", 1) instead of concatenating s

Re: Difference between CPython, Python for .NET and IronPython?

2006-02-18 Thread Diez B. Roggisch
> For example, if I'm running IronPython, can I access modules such as Numeric > and numarray? AFAIK not. You can run pure python modules, but not extensions containing native code. > As I understand it, interoperability with C# and .NET works in both > directions with IronPython, but CPython mo

Re: [DICTIONARY] - Copy dictionary entries to attributes

2006-02-18 Thread Diez B. Roggisch
Ilias Lazaridis schrieb: > remark: not sure if the term "dictionary" is correct here. > > I have the following situation: > > within a setup.cfg, settings are passed this way: > > settings=project_page=theProjectPage.com > myVar=myValue > > those are accessible later like this: > > set

Re: 2-dimensional data structures

2006-02-18 Thread Diez B. Roggisch
> However, I wondering how to approach the search of the nine regions of > the grid. I am thinking of producing another nested list, again 9x9 to > store the contents of each region, and to update this after each pass > through -and update of- the main grid (row and column). > > I am not sure h

Re: 2-dimensional data structures

2006-02-18 Thread Diez B. Roggisch
Diez B. Roggisch schrieb: > The question is not so much which region a give square is in, but more > which square contains which fields. If we assume that you number your > squares row-wise (top-left zero, top-right 3, bottom-right 9), this > function computes the field indices

cElementTree encoding woes

2006-02-20 Thread Diez B. Roggisch
Hi, I've got to deal with a pretty huge XML-document, and to do so I use the cElementTree.iterparse functionality. Working great. Only trouble: The guys creating that chunk of XML - well, lets just say they are "encodingly challanged", so they don't produce utf-8, but only cp1252 instead, togethe

Re: cElementTree encoding woes

2006-02-20 Thread Diez B. Roggisch
> Both my python2.3 and python2.4 interpreters seem to know "Windows-1252": > import codecs codecs.open("windows.xml", encoding="windows-1252") > > > Maybe the problem lies in the python installation rather than > cElementTree? Just guessing, though. Hm. No idea why I was under the im

Re: decorator and function local variable

2006-02-20 Thread Diez B. Roggisch
Grzegorz Smith schrieb: > Hi all. I have got situation that I need make parameter injection into > function and I want that parametet be a local variable of that function. > eg. something like > def decorator(): > > @decorator > def myfun(): >a = 20 >

Re: Writing my own typing monitor program for RSI sufferers...

2006-02-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > So, so close The problem with this implementation is that it > doesn't monitor usb keyboards under linux at all as far as I can > tellsince no keyboard entry will show up in /proc/interrupts with a > usb keyboard. I absolutely need the keyboard monitoring as w

Re: DCOracle2: OCI error

2006-02-21 Thread Diez B. Roggisch
Chris wrote: > Update: Instead of disconnect / reconnect, I made it so that in case of > 1084 errors I rollback and retry the same INSERT again. > It worked... It's not beautiful code but it's working. > So really I think something's fishy in dco2.c > If someone tell me what should be investigated

Re: Video Capture modules in linux

2006-02-21 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > well wht can i say it simply refuses to compile...i m getting make > errors. i think the culprit is the gcc-4.0..secondly i havent had a > chance to really try it out..aneways does libfg manipulate inputs from > webcams..like VideoCapture modules ..also i think libfg is

Weekly Python Patch/Bug Summary

2006-02-21 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 385 open (-14) / 3067 closed (+25) / 3452 total (+11) Bugs: 864 open (-59) / 5621 closed (+68) / 6485 total ( +9) RFE : 211 open ( +2) / 200 closed ( +2) / 411 total ( +4) New / Reopened Patches __ GNU uses

Re: make a class instance from a string ?

2006-02-23 Thread Diez B. Roggisch
Bo Yang wrote: > Hi, > I know in java , we can use > > class.ForName("classname") > > > to get an instance of the class 'classname' from a > string , in python , how do I do that ? You can use getattr(module, classname)(*arguments) Diez -- http://mail.python.org/mailman/listinfo/python

Re: cx_Oracle and UTF8

2006-02-23 Thread Diez B. Roggisch
Harald Armin Massa wrote: > Hello, > > I am looking for a method to convince cx_Oracle and oracle to encode > it's replies in UTF8. > > For the moment I have to... > > cn=cx_Oracle.connect("user","password", "database") > cs=cn.Cursor() > > cs.execute("select column1, column2, column3 from ta

Re: Get Root access in Linux?

2006-02-23 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Does anyone know how to call for the root prompt before launching your > app? > Kinda like synaptic or the superuser file manager does? That is Windowmanager/Desktop dependand. For KDE, you can e.g. create links to applications that instruct the KDE to first acquire roo

Re: make a class instance from a string ?

2006-02-23 Thread Diez B. Roggisch
Luke Plant wrote: > Bo Yang wrote: > >> I know in java , we can use >> >> class.ForName("classname") >> >> >> to get an instance of the class 'classname' from a >> string , in python , how do I do that ? > > In Python, classes are first class objects, so normally you would pass > the class itsel

Re: Detec nonascii in a string

2006-02-23 Thread Diez B. Roggisch
Sebastian Bassi wrote: > Hello, > > How do I detect non-ascii letters in a string? > I want to detect the condition that a string have a letter that is not > here: string.ascii_letters "äöü".decode("ascii") should do the trick -- you get an UnicodeError when there is anything ascii can't encode

Re: need help regarding compilation

2006-02-23 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > i am new to learning jython... > > > i just tried compiling a small piece of code that is given below: > > def fac(x) > if x<=1:return 1 > return x*fac(x-1) You really have a book about python that doesn't mention that functions definitions are closed by a colon? I

Re: PYTHONPATH?

2006-02-24 Thread Diez B. Roggisch
Dr. Pastor wrote: > Several Documents about Python > refer to PYTHONPATH. > I could not find such variable. > (Python 2.4.2, IDLE 1.1.2, Windows XP) > How should/could I nominate a Directory to be > the local Directory? > Thanks for any guidance. It's a so called environment-variable. You can set

Re: Exception-handling

2006-02-24 Thread Diez B. Roggisch
Odd-R. wrote: > I have come over a strange problem regarding exceptions > This is my code: > > try: > #some operation > except Exception, info: > #some message > except: > #?? > > When executing my code, I get to the last block here. This > I find rather strange, because I thought Exceptio

Re: A C-like if statement

2006-02-24 Thread Diez B. Roggisch
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> Side-effects aren't always bad (import, for example, does all its work by >> side-effect). But they are generally frowned upon, and in functional >> languages they are verboten. > > How do you d

Re: chrtohex

2006-02-24 Thread Diez B. Roggisch
luca72 wrote: > Hello again my friends > > here's my new problem. > > How i can translate chr in to hex or int to integer value? print "%x" % ord('a') Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Module written in C does not repond to Ctrl-C interruption.

2006-02-24 Thread Diez B. Roggisch
Bo Peng wrote: > Dear list, > > I have not done a thorough test, but it occurs to me that > > 1. python code can be interrupted by Ctrl-C. > 2. A C module, if I add a main() function and run independently, can be > interrupted by Ctrl-C. > 3. If I load the C module in python and run, the program

Re: Exception not raised

2006-02-24 Thread Diez B. Roggisch
Michele Petrazzo wrote: > Simple example extract from my code: > > #code > def test(): > print type(t_fields), 11 in t_fields > print t_fields[11] > print "I'm here" > > print "ok" > test() > print "ok" > #end code > > Output: > > ok > False > > Here I see only one "ok" and not the "I'm here

Re: PyQt - multiple window instances?

2006-02-24 Thread Diez B. Roggisch
gregarican schrieb: > I have an PyQt app were I need one of the windows to be able to be > opened more than one at a time. When I try to open it I only get one > instance at the same time. The main class is the QWidget() class with a > QGridLayout() displaying the various window components. > > Is

Re: PyQt - multiple window instances?

2006-02-24 Thread Diez B. Roggisch
gregarican schrieb: > The window isn't being created as a new class instance or anything. Yes it is. QWidget() creates a new instance of QWidget. > The > main class is the application main window as a whole and this > particular window is just part of that class. I have typed data into > the win

Re: Exception not raised

2006-02-24 Thread Diez B. Roggisch
> This code are inside a method into class that have no try/except. And > called from a method inside a wx.Frame derivate. The other strange thing > is that if I try the same code just before the "caller" to that method, > it raise an exception: So maybe the C-layer of wx in-between doesn't pro

Re: Multiple threaded download streams?

2006-02-25 Thread Diez B. Roggisch
> Use a separate thread for downloading. Or the twisted select-reactor. No threads needed. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Do I need to convert string to integer in python?

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Do I need to convert string to integer in python? or it will do it for > me (since dynamic type)? > > In my python script, I have this line: > x /= 10; > > when i run it, I get this error: > TypeError: unsupported operand type(s) for /=: 'unicode' and 'int' > > I

Re: How can I find the remainder when dividing 2 integers

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I have a string array: > colors = ["#ff", "#00FF00", "#FF"] > colorIndex = 0; > > and I want to loop thru each element of colors > > for str in strings: > print colors[colorIndex++ % colors.length] > > > But i get an invalid syntax error when I execute the

Re: How can I find the remainder when dividing 2 integers

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > okay, I try you suggestion, and re-write my code like this: > colors = ["#ff", "#00FF00", "#FF"] > colorIndex = 0 > > def getText(nodelist): > > > for str in strings: > > print colors[colorIndex % colors.length] >

Re: How can I find the remainder when dividing 2 integers

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Can you please tell me what is the meaning of > UnboundLocalError: local variable 'colorIndex' referenced before > assignment > > in general? Well, pretty much of what it says: You tried to access a variable without prior assignment to

Re: UnboundLocalError: local variable 'colorIndex' referenced

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Can you please tell me what is the meaning this error in general? > > UnboundLocalError: local variable 'colorIndex' referenced before > assignment > > In my python script, > I have a variable define and init to 0, like this > colorIndex = 0 > > and in one of my fu

Re: python newbie question

2006-02-26 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I am new to python, can you please tell me how can I convert my python > script into an executable on linux? > i.e. instead of typing 'python myscript.py abc', I just need to do > 'myscript.py abc'? > and how can I get the input argument from my script , in my example,

Re: Memory allocation in for loops

2006-02-26 Thread Diez B. Roggisch
> I mean what I really would like is to have something C++ - like "for > (int idx = a; idx < b; i++) { .. }" where no internal vector or > something like that is allocated but only a few op's on registers are > performed; in the whileloop in python the picture is

Re: ''.join() with encoded strings

2006-02-27 Thread Diez B. Roggisch
Sandra-24 wrote: > I'd love to know why calling ''.join() on a list of encoded strings > automatically results in converting to the default encoding. First of > all, it's undocumented, so If I didn't have non-ascii characters in my > utf-8 data, I'd never have known until one day I did, and then t

Weekly Python Patch/Bug Summary

2006-03-01 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 382 open ( -3) / 3079 closed (+12) / 3461 total ( +9) Bugs: 880 open (+16) / 5624 closed ( +3) / 6504 total (+19) RFE : 211 open ( +0) / 201 closed ( +1) / 412 total ( +1) New / Reopened Patches __ PEP 357 -

Re: Problem with dbi, odbc module and Oracle 9.2 - suffixed "L" with number data type

2006-03-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I was messing around with the native ODBC module (I am using Python in > a Win32 environment), e.g: > > import dbi, odbc > > ...and it seems to meet my needs. I'd rather use a module that comes > natively with Python if it works (don't care about performance in this >

Re: Problem with dbi, odbc module and Oracle 9.2 - suffixed "L" with number data type

2006-03-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Great, thanks Diez! Should I just use str(n) to convert it to a format > I can write out to a flat file? I'm also struggling with the strange I guess so, yes. > date object format that the ODBC module returns when I fetch rows. I > need to convert that to a text string

Re: ODBC module and strange date reference <...>

2006-03-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Sorry for the double-thanks Frank. > > I'm using Python 2.1 for Win32 and import datetime fails. > > Does the datetime module come standard with later releases of Python? > If so, which release? If not, will datetime with with Python 2.1, if it > will, where can I get

Re: filename variables

2006-03-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > If in Windows XP I use: > > openstring= "test.py >foo.txt" > os.system(openstring) > > it works. > > > But if I use: > > file1='foo.txt' > openstring= "test.py >"+file1 > > It gives an IOError about no such file or directory as > \\mydidr\\foo.txt > > What does

Re: PyQt issue

2006-03-03 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I'm trying to write a simple dialog with PyQt. Ive got this code as > one of the slots: > > def setFixed(self): > if len(str(self.fixed_label.displayText())) == 0: > QMessageBox.critical(self, "Label Missing", "You must enter > a label.") >

Re: Win32api, pyHook, possibly win32com, not sure XD, thats why I'm posting

2006-03-04 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Is there a way to hide a python instance from the Task Manager process > list? Try sony's rootkit. Or any other. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggesting the use of StandardError as base of error Exceptions.

2006-03-06 Thread Diez B. Roggisch
Antoon Pardon schrieb: > In a number of cases I have a program that looks like the following. > > for case in all_cases: > try: > treat(case) > except Exception, ErrInfo: > generate_traceback() > > The idea is to get as much information as possible when something > goes wrong but at t

Re: processing the genetic code with python?

2006-03-06 Thread Diez B. Roggisch
nuttydevil schrieb: > I've tried various ways of doing this but keep coming unstuck along the > way. Has anyone got any suggestions for how they would tackle this > problem? > Thanks for any help recieved! Show us your ways, show us where you got stuck - then we'd might be able to help you. Diez

Re: Need help initializing a list or tuple.

2006-03-06 Thread Diez B. Roggisch
KraftDiner schrieb: > Thank you that worked great! > > a = [[None] * 256] * 256 > for i in range(0,256): > for j in range(0,256): > a[i][j] = i**2 > > Now.. Can I change this quickly into a 1 dimensional list of length > 65536? sum(a, []) Diez -- http://mail.python.org/ma

Re: Is python support jxta now?

2005-05-02 Thread Diez B. Roggisch
now. Or there is any lib in python that already implement a p2p > protocol? Please insight me, thanks a lot ( : Bittorrent, one of the most actively used p2p protocols is _written_ in python. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Weekly Python Patch/Bug Summary

2005-05-02 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 322 open ( +6) / 2832 closed ( +1) / 3154 total ( +7) Bugs: 920 open (+12) / 4952 closed (+11) / 5872 total (+23) RFE : 186 open ( +8) / 156 closed ( +3) / 342 total (+11) New / Reopened Patches __ Info Asso

Weekly Python Patch/Bug Summary

2005-05-10 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 332 open (+10) / 2834 closed ( +2) / 3166 total (+12) Bugs: 927 open ( +7) / 4959 closed ( +7) / 5886 total (+14) RFE : 186 open ( +0) / 157 closed ( +1) / 343 total ( +1) New / Reopened Patches __ Feature e

Weekly Python Patch/Bug Summary

2005-05-17 Thread Kurt B. Kaiser
python.org/sf/1202533 opened by Armin Rigo Problem with abs function (2005-05-16) http://python.org/sf/1202946 opened by ric-b Bugs Closed ___ time module ignores timezone changes (2005-05-09) http://python.org/sf/1198275 closed by bcannon SystemError: error retu

Weekly Python Patch/Bug Summary

2005-05-25 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 342 open ( +3) / 2839 closed ( +1) / 3181 total ( +4) Bugs: 936 open ( -2) / 4974 closed (+12) / 5910 total (+10) RFE : 189 open ( +2) / 159 closed ( +2) / 348 total ( +4) New / Reopened Patches __ optparse

Re: Xml writing in Python and verifying using XSD

2005-05-27 Thread Diez B. Roggisch
that could be tried is to feed that dom tree instead of a xml string to a validation process - but if that's doable I'm not sure, and it doesn't buy you too much performance gain. So stick with the write/validate process described above. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: using builtin array

2005-06-01 Thread Diez B. Roggisch
> (0xFF 0x00 0x00 0x00 0x00 0x00 0xF0F0F0F0 0x) An arry has one typecode that applies to all its elements - so what you want can't be done. But you can use two lists and the module struct to create a string that resembles the memory layout you want. data1 = [0] * 6 data2 =

Re: unsigned long to unsigned char

2005-06-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > Is it possible to convert unsigned long( 4 bytes) to unsigned char(1 > byte), so that i could define a common array for both. > > import array > temp = array('B', '\0' * 512) > > for i in range( 2): >

Re: using builtin array

2005-06-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I am constructing a packet, with the first 6 bytes being the > destination address, followed by src, and type. As I told you - use struct. > The remaining space > will be filled with data. I need to use an array because of the > buffer_info method i am calling. That's

Re: Monitoring a USB-drive / Card-reader using python?

2005-06-01 Thread Diez B. Roggisch
Thomas W wrote: > I want to monitor a given USB-device, like a Memory Card-reader, and > when a memory card is inserted I want to move the data on the card to a > different location on the filesystem ( or do something else with the > files). > > Does anybody know how to do this ( on Linux and/or w

Weekly Python Patch/Bug Summary

2005-06-01 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 344 open ( +2) / 2845 closed ( +6) / 3189 total ( +8) Bugs: 916 open (-20) / 5014 closed (+40) / 5930 total (+20) RFE : 191 open ( +2) / 163 closed ( +4) / 354 total ( +6) New / Reopened Patches __ Optimizat

Re: using builtin array

2005-06-02 Thread Diez B. Roggisch
> Arrays are homogenous. No chance concatenating them. This should of course read "No chance concatenating arrays of different typecodes". -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

Re: DOM question

2005-06-02 Thread Diez B. Roggisch
) == section] It looks from the root throug all the descending childs // after nodes with name section section that fulfill the predicate [id==$id_param] >From this out we collect all immediate children /node() that are not of type section [!name() == section] -- Regards, Diez

Re: Two questions

2005-06-02 Thread Diez B. Roggisch
rbt wrote: > Peter Hansen wrote: > >> Philosophy not entirely aside, you should note that object code in any >> language can "easily" be reverse-engineered in the same way, with the >> only difference being the degree of ease involved. If the code is >> worth enough to someone that they are wi

Re: DOM question

2005-06-02 Thread Diez B. Roggisch
> > Yes, in fact: > > //[EMAIL PROTECTED]//*[name()!='section'] > > would do the trick. > > I was trying to avoid using anything not in the standard Python > distribution if I could help it; I need to be able to use my code on > Linux, OS X and Windows. > > The xml.path package is from PyXML,

Re: XML help

2005-06-05 Thread Diez B. Roggisch
> > I've managed to test for specific elements and extract values. I want to > place the reults in arrays with array index equal to element ID. So as I > walk the tree I temporarily store IDs and DeptValues in lists. I'm ok so > far. I then intend to create an array of size determined by the maxim

Re: time consuming loops over lists

2005-06-07 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: X-No-Archive: yes Can some one help me improve this block of code...this jus converts the list of data into tokens based on the range it falls into...but it takes a long time.Can someone tell me what can i change to improve it... if data[i] in xrange(r

Re: time consuming loops over lists

2005-06-07 Thread Diez B. Roggisch
> I don't see a "break" so why the "/2" ? also IIUC the That was the assumption of an equal distribution of the data. In O-notationn this would be O(n) of course. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a DOM element's children by type (STUPID)

2005-06-08 Thread Diez B. Roggisch
Tom Anderson wrote: > This strikes me as a rather common thing to want to do, but i can't see > a method for it; it seems i have to go through elem.childNodes myself, > fishing out the ones i want. Or rather, to write exactly the same > three-line helper function that millions of other people mu

Re: Fast text display?

2005-06-08 Thread Diez B. Roggisch
> > That looks quite good, except that Trolltech doesn't yet have a GPL-qt > for Win32. I might take another look at it whenever qt4 comes out, but > in the meantime (since I'm unfortunately developing on a win2k system) > it's not useful. Look at qt feee win edition, available here: http://

Re: XML + SOAP + Webservices

2005-06-09 Thread Diez B. Roggisch
Johan Segernäs wrote: > I'm put on building a system in Python and I haven't used either webservices, > SOAP or Python so I'm a bit lost. > > This system will require callback functions, should I use Python thru Apache > for this or build my own listening daemon? Use module for Apache or do I make

Re: pack heterogeneous data types

2005-06-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello, > > How do i pack different data types into a struct or an array. Examples > would be helpful. > > Say i need to pack an unsigned char( 0xFF) and an long( 0x) > into a single array? The reason i need to do this is send a packet over > a network. You've b

Re: XML + SOAP + Webservices

2005-06-09 Thread Diez B. Roggisch
> Basically, don't write the implementation to talk to the SOAP/WDSL-services > in Python, find something else and this 'something else' produces an XML file > which I then parse with Python? For example - or better, instead of passing XML use an RPC mechanism Python is good at - e.g. corba. So y

Weekly Python Patch/Bug Summary

2005-06-09 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 339 open ( -5) / 2857 closed (+12) / 3196 total ( +7) Bugs: 908 open ( -8) / 5036 closed (+22) / 5944 total (+14) RFE : 189 open ( -2) / 168 closed ( +5) / 357 total ( +3) New / Reopened Patches __ Trivial t

Re: python bytecode grammar

2005-06-10 Thread Diez B. Roggisch
M1st0 wrote: > where I can find the grammar of python bytecode ? ( better if is in BCF > ). There is no grammar for bytecodes - the are like assembly instructions. And what's BCF supposed to mean - BNF is a form for grammars, BCF I never heard of. And besides that: tell us what you're after, we

Re: python bytecode grammar

2005-06-10 Thread Diez B. Roggisch
M1st0 wrote: > Ops yes is BNF :P Bacus Normal Form if I am not wrong... > > However.. > > I'am tryng to recognizing patterns in a bytecoded file in orderd to > optimize... > > But I would like to "parse" i.e reconstruct it in something like a > tree.. > in order to apply rules on a tree rec

Re: about accessing mysql

2005-06-10 Thread Diez B. Roggisch
sinan , wrote: > hi everybody, i have a small mysql connection code > > import MySQLdb db=MySQLdb.Connection(host="localhost",user="root",db="nux") > > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line > 66,

Re: Dealing with marketing types...

2005-06-10 Thread Diez B. Roggisch
Will McGugan wrote: > Marketing types need a bandwagon to jump on. Point out that Google is > used by Google, ILM and NASA. Certainly a true statement - but I've got the sneaky suspicion that the first google was supposed to be python. Diez -- http://mail.python.org/mailman/listinfo/python-lis

Weekly Python Patch/Bug Summary

2005-06-14 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 338 open ( -1) / 2861 closed ( +4) / 3199 total ( +3) Bugs: 909 open ( +1) / 5047 closed (+11) / 5956 total (+12) RFE : 188 open ( -1) / 170 closed ( +2) / 358 total ( +1) New / Reopened Patches __ byteorder

Re: Threading and serial port access

2005-06-18 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, > > I'm writing a program which requires the use of three serial ports and > one parallel port. My application has a scanning devices on each port, > which I can access fine with pyserial. However, I'm unsure of how > exactly I should be designing the program, I th

Re: extreme newbie

2005-06-18 Thread Diez B. Roggisch
cpunerd4 wrote: > what I mean by secure is that no one can steal the code. I want to > create comercial applications eventually. (although I will work on open > source I hope, so don't get mad at me) and calling me cpunerd4 will be > fine. Commercial applications don't suffer from code-stealing. T

Re: How to clean a module?

2007-06-01 Thread Diez B. Roggisch
ai wrote: > Yes, you are right. > But from this problem, could I infer that the statement "del xxx" > doesn't release the memory which xxx used? It just removes the name xxx from the current scope - which will result in a reference counter decrease. If that was the last reference, the object will

Re: execute a function after each source code line ?

2007-06-01 Thread Diez B. Roggisch
stef wrote: > hello, > > doing a simulation of another language (JAL), > I translate the other language into Python code, > then I execute this converted Python code. > > Now I need todo some checks and give visual feedback to the user, > each time a line of code is executed. > > One way of rea

Re: subexpressions

2007-06-01 Thread Diez B. Roggisch
Steve Howell wrote: > --- Sergey Dorofeev <[EMAIL PROTECTED]> wrote: >> > What syntax would you suggest for a lambda >> enhanced to cover your use >> > case? >> > I suppose you will end up with roughly the same >> number of characters, all >> > crammed in one line -- or broken into lines at a >> r

Re: subexpressions

2007-06-01 Thread Diez B. Roggisch
> Ok, I stand corrected. > > Duplicate subexpressions are pretty easy to avoid in > Python, so though an optimization would not be > impossible here (checking for immutability of > builtins, etc., which still assumes the idea that > multiplication is more expensive than checking for > immutability

Re: magic names in python

2007-06-04 Thread Diez B. Roggisch
per9000 wrote: > On Jun 4, 9:11 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> In <[EMAIL PROTECTED]>, per9000 >> wrote: >> > >> > [...] >> > >> > So another question emerges: >> > * is the use of magic names encouraged and/or part of good coding >> > practice. >> >> What do you mean

Re: python for EE CAD program

2007-06-04 Thread Diez B. Roggisch
chewie54 wrote: > Hi All, > > I have read some posts on this subject but I haven't been able to make > a decision whether to use Python or not. > > I'm considering converting a Java CAD program to Python/C with > wxWdigets for the GUI. > > I don't have good answers for: > > 1) Can I use py2ex

Re: python for EE CAD program

2007-06-04 Thread Diez B. Roggisch
> Hello Diez, > > I did look at PythonCad but the distribution and install methods for > Windows is not user freindly. Since the public domain software, I > don't think they protect the source code either. The subject of code obfuscation in python has been beaten to death quite a few times on th

Re: how to convert a bitmap file to an array ?

2007-06-05 Thread Diez B. Roggisch
stef wrote: > hello > > I can find all kind of procedures to convert an array to a bitmap > (wxPython, PIL), > but I can't find the reverse, > either >- convert a bitmap to an array > or > - read a bitmap file to an array Not true for PIL, Image.getdata and Image.putdata are your friends.

Re: *args and **kwargs

2007-06-05 Thread Diez B. Roggisch
JonathanB wrote: > Ok, this is probably definitely a newbie question, but I have looked > all over the Python library reference material and tutorials which I > can find online and I cannot find a clear definition of what these are > and more importantly how to use them. From what I can tell from

RE: Please help on Binary file manipulation

2007-06-05 Thread Looney, James B
Pieter, I've found when I have questions like this, that thinking about how I'd do it in C/C++, then searching on some of those key words leads me to a Python equivalent solution, or at least heading down the right path. In this case, I believe you'll find the "file" module helpfull. You can rea

<    10   11   12   13   14   15   16   17   18   19   >