Re: Micro-threading PEP proposal announcement

2008-08-26 Thread Pau Freixes
Sorry Bruce, When can I read this PEP ? I'm interesting Bye On Mon, Aug 25, 2008 at 7:15 PM, Bruce Frederiksen <[EMAIL PROTECTED]>wrote: > I wanted to make everybody aware that I've posted a (rather long and > involved) PEP proposal for adding micro-threading to Python on > python-ideas for fee

Re: mailbox module

2008-08-26 Thread ra9ftm
ok, may be it is truth, because class UnixMailbox is working. I found it in "Depricated classess and methods" in manual :( here is only version 2.4 in Debian ra9ftm: > I am using Debian 4.0 Etch for my tests. May be old version of python > in this repository? -- http://mail.python.org/m

How to manipulate list of dictionary

2008-08-26 Thread ajak_yahoo
Hi, Need some help, I have a list of dictionary as below, table = [{"Part #":"Washer","Po #":"AE00128","qty":100}, {"Part #":"Brake Pad","Po #":"AE00154","qty":150}, {"Part #":"Mesh","Po #":"AE00025","qty":320}, {"Part #":"Mouse","Po #":"AE00207","qty":120}, {"

Re: smart quotes

2008-08-26 Thread Peter Otten
Adrian Smith wrote: > Can anyone tell me how to get rid of smart quotes in html using > Python? I've tried variations on > stuff = string.replace(stuff, "\“", "\""), but to no avail, presumably > because they're not standard ASCII. Convert the string to unicode. For that you have to know its enco

Are dictionaries the same as hashtables?

2008-08-26 Thread cnb
Are dictionaries the same as hashtables? -- http://mail.python.org/mailman/listinfo/python-list

How to bind an event in Tix combo box?

2008-08-26 Thread dudeja . rajat
Hi, I'm a newbie and created a new combo box with Tix. The combo box is filled with the required items. I've used Tkinter's listbox and used the event and bind that with a callback. Now, I want to do the same stuff with the Tix combo box. Please suggest how can I do the same in Tix combo box.

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Martin Marcher
On 2008-08-26 00:32:20, cnb wrote: > Are dictionaries the same as hashtables? Yes, but there is nothing in there that does sane collision handling like making a list instead of simply overwriting. PS: your sig was *a bit* longer than you question. please don't do that... signature.asc Descripti

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread cnb
On Aug 26, 9:43 am, Martin Marcher <[EMAIL PROTECTED]> wrote: > On 2008-08-26 00:32:20, cnb wrote: > > > Are dictionaries the same as hashtables? > > Yes, but there is nothing in there that does sane collision handling > like making a list instead of simply overwriting. > > PS: your sig was *a bit*

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread frankentux
Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import TableRow,TableCell from odf.text import P doc = load("/tmp/match_data.ods") d = doc.sp

ctypes - loading 'librsvg-2-2.dll'

2008-08-26 Thread Tim Grove
Any ideas why a particular dll won't load on Windows XP Pro using ctypes? The dll in question is 'librsvg-2-2.dll' (a link if anyone cares to try!!! http://ftp.gnome.org/pub/gnome/binaries/win32/librsvg/2.22/) The other dlls from the GTK libraries seem to load okay, so I'm more than puzzled!! I

Re: How to manipulate list of dictionary

2008-08-26 Thread Simon Brunning
2008/8/26 ajak_yahoo <[EMAIL PROTECTED]>: > Need some help, I have a list of dictionary as below, > > table = [{"Part #":"Washer","Po #":"AE00128","qty":100}, > {"Part #":"Brake Pad","Po #":"AE00154","qty":150}, > {"Part #":"Mesh","Po #":"AE00025","qty":320}, > {"Part #":

Re: property() usage - is this as good as it gets?

2008-08-26 Thread Bruno Desthuilliers
David Moss a écrit : Hi, I want to manage and control access to several important attributes in a class and override the behaviour of some of them in various subclasses. Below is a stripped version of how I've implemented this in my current bit of work. It works well enough, but I can't help f

Re: rules of thumb for cross os code

2008-08-26 Thread Bruno Desthuilliers
DwBear75 a écrit : I am considering using python as a replacement for a lot of bash scripting that I have been doing. I would like to be as cross platform as possible, writing scripts for both windows and linux. Are there any guides are general rules of thumb on 1) keeping code os independant

Retrieve Win32 domain name

2008-08-26 Thread Salim Fadhley
I'm looking for a method to retrieve a Windows Domain name (not a DNS Domain name). I know this can be done by simply reading an environment variable, however on the machines I need to work with sometimes the environment variables can be messed-up and are not trustworthy. Is there somebody who kn

Retrieve Win32 domain name

2008-08-26 Thread Salim Fadhley
I'm looking for a method to retrieve a Windows Domain name (not a DNS Domain name). I know this can be done by simply reading an environment variable, however on the machines I need to work with sometimes the environment variables can be messed-up and are not trustworthy. Is there somebody who kn

Re: Python String Immutability Broken!

2008-08-26 Thread Hendrik van Rooyen
"Simon Brunning": >You can indeed use ctypes to modify the value of a string - see >. You can use it to crash the OS, too. > >My advice - don't. Thanks for the link. Any advice on what to do or use as an I/O structure for dissemination? Ken Seehart: 8<--- u

Re: setattr and getattr, when to use?

2008-08-26 Thread Bruno Desthuilliers
Jason Scheirer a écrit : (snip) The 5% of your time when you are doing metaprogramming or other abuses of the object system are when you use get/setattr. What makes you label "metaprogramming" and get/setattr as "abuses" ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Total No. of "Records" in a File?

2008-08-26 Thread Bruno Desthuilliers
W. eWatson a écrit : I have an ordinary text file with a CR at the end of a line, and two numbers in each line. Is there some way to determine the number of lines (records) in the file before I begin reading it? How could you know how many times a given character appears in file without readi

Re: Total No. of "Records" in a File?

2008-08-26 Thread Bruno Desthuilliers
W. eWatson a écrit : Fredrik Lundh wrote: W. eWatson wrote: I have an ordinary text file with a CR at the end of a line, and two numbers in each line. Is there some way to determine the number of lines (records) in the file before I begin reading it? In the general case, no. A file is just

Re: A variables variables

2008-08-26 Thread Bruno Desthuilliers
castironpi a écrit : On Aug 23, 7:25 pm, Gandalf <[EMAIL PROTECTED]> wrote: how can I declare a variable with another variable name? for example I will use PHP: $a= "hello"; $a_hello="baybay"; print ${'a_'.$a) //output: baybay how can i do it with no Arrays using python thanks! Here'

Re: What is class method?

2008-08-26 Thread Bruno Desthuilliers
MeTheGameMakingGuy a écrit : On Aug 24, 6:32 pm, Hussein B <[EMAIL PROTECTED]> wrote: Hi, I'm familiar with static method concept, but what is the class method? how it does differ from static method? when to use it? -- class M: def method(cls, x): pass method = classmethod(method) -- Than

Re: What is class method?

2008-08-26 Thread Bruno Desthuilliers
Maric Michaud a écrit : (snip) > It is a common advice that staticmethod should not exist in python, as they do nothing compared to module level functions, They "do" nothing more, but are accessible thru a class object instead of being accessible thru a module object. It sometimes happens to b

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread ++imanshu
On Aug 26, 11:52 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > ++imanshu wrote: > >     Wouldn't it be nicer to have 'in' return values (or keys) for both > > arrays and dictionaries. Arrays and Dictionaries looked so similar in > > Python until I learned this difference. > > It's because deali

Re: generate methods at runtime, but the wrong one gets called

2008-08-26 Thread Bruno Desthuilliers
Maric Michaud a écrit : (snip) i don't get your design, it seems over-complicated to mee at first glance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread John Machin
On Aug 26, 5:43 pm, Martin Marcher <[EMAIL PROTECTED]> wrote: > On 2008-08-26 00:32:20, cnb wrote: > > > Are dictionaries the same as hashtables? > > Yes, but there is nothing in there that does sane collision handling > like making a list instead of simply overwriting. > Please clarify: (1) Nothi

Re: How to manipulate list of dictionary

2008-08-26 Thread Bruno Desthuilliers
Simon Brunning a écrit : 2008/8/26 ajak_yahoo <[EMAIL PROTECTED]>: Need some help, I have a list of dictionary as below, table = [{"Part #":"Washer","Po #":"AE00128","qty":100}, {"Part #":"Brake Pad","Po #":"AE00154","qty":150}, {"Part #":"Mesh","Po #":"AE00025","qty":320},

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Diez B. Roggisch
Martin Marcher wrote: > On 2008-08-26 00:32:20, cnb wrote: >> Are dictionaries the same as hashtables? > > Yes, but there is nothing in there that does sane collision handling > like making a list instead of simply overwriting. The term "collision" is rather well defined when talking about assoc

logging exceptions

2008-08-26 Thread Alexandru Mosoi
why doesn't logging throw any exception when it should? how do I configure logging to throw exceptions? >>> try: ... logging.fatal('asdf %d', '123') ... except: ... print 'this line is never printed' ... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2

Python LDAP

2008-08-26 Thread Juan
Hi I am trying to make a simple Python script using LDAP. The module is imported OK, but when I call the function open or initialize, I get this error: Traceback (most recent call last): File "/home/juan/workspace/amquare/src/nutum/amquare/amquare.py", line 122, in conn.connect() File "/

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Ben Finney
cnb <[EMAIL PROTECTED]> writes: > Are dictionaries the same as hashtables? The 'dict' type in Python has certain behaviour, as specified in the language reference. In CPython they are implemented as hash tables, but I don't recall anything that specifies they *must* be implemented that way. So m

Re: Is my thinking Pythonic?

2008-08-26 Thread Bruno Desthuilliers
Fredrik Lundh a écrit : Bruno Desthuilliers wrote: Given the lack of proper support for the descriptor protocol in old-style classes and a couple other diverging behaviors, I wouldn't say that advising newcomers to use new-style classes is so pointless. Yeah, but if you don't need descriptor

Re: Overwriting property-> can't set attribute

2008-08-26 Thread Bruno Desthuilliers
norseman a écrit : Gregor Horvath wrote: Hi, why is this code failing? class B(object): pass B.testattr = property(lambda s:"hallo") b = B() b.testattr = "test" Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) /tmp/python-14202ViU.py in () 14 B.testattr = property(lambda s:"hallo"

Re: Overwriting property-> can't set attribute

2008-08-26 Thread Bruno Desthuilliers
Gregor Horvath a écrit : Hi, why is this code failing? class B(object): pass B.testattr = property(lambda s:"hallo") b = B() b.testattr = "test" Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) /tmp/python-14202ViU.py in () 14 B.testattr = property(lambda s:"hallo") 15 b = B()

Ctypes module - looking for a way to dynamically call exported function from a set of dlls

2008-08-26 Thread dudeja . rajat
Hi, I'm using the ctypes module to load my dlls. I have some 10 dlls the names of those are passed to a fucntion which then loads the passed dll. Now every dll has a getversion function. eg: A.dll, B.dll, C.dll are the dlls and GetVersion functions are as: A_getVersion(), B_getVersion(), C_getVe

RPCXML hide implementation.

2008-08-26 Thread x_O
Hi I'm working recently with XMLRPC for python and It never was so easy. But I've meet a obstacle. Because python is not giving us any reasonable encapsulation mechanism, I have problems with hiding some part of the implementation. When class has 2 methods and I want to make rpc private only ON

properties with subscripted variables

2008-08-26 Thread Fabrizio Pollastri
Hi, I work on the python module AVC (http://avc.inrim.it) useful for the development of applications with GUIs. AVC is based on the property mechanism: any a variable controlled by AVC is set as a property, so when it is assigned by the application program, the __set__ function is called and AVC do

Re: Python Strinh Immutability Broken!

2008-08-26 Thread Hendrik van Rooyen
"Gabriel Genellina": >To avoid altering the equilibrium of the whole universe, use >ctypes.create_string_buffer: >http://python.net/crew/theller/ctypes/tutorial.html#fundamental-data-types Thanks Gabriel – looks like I really have to spend more time with that excellent document. Patrick Maupin

Libraries for internal SOA components

2008-08-26 Thread Artur Siekielski
Hi. I'm looking for libraries for implementing SOA components (not necessery web services). Most of the components are not communicating with "the world". Language independence is not very important (Python is everywhere :). Important requirement is ability to process requests in parallel, and bec

Setting my Locale

2008-08-26 Thread Robert Rawlins
Good morning Guys, I'm running python 2.5 on a Debian based system and I'm looking for your advice on how to set the locale for my application. I've read through the locale module documentation http://docs.python.org/lib/module-locale.html and tried a couple of the examples but can't seem to ge

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread bearophileHUGS
"++imanshu: > Wouldn't it be nicer to have 'in' return values (or keys) for both > arrays and dictionaries. Arrays and Dictionaries looked so similar in > Python until I learned this difference. D language works like you say, and it's awful. With a key you can find its value, but given only th

Re: properties with subscripted variables

2008-08-26 Thread Bruno Desthuilliers
Fabrizio Pollastri a écrit : Hi, I work on the python module AVC (http://avc.inrim.it) useful for the development of applications with GUIs. AVC is based on the property mechanism: any a variable controlled by AVC is set as a property, so when it is assigned by the application program, the __set_

[ANNOUNCE] pygtkmvc-1.2.2 has been released

2008-08-26 Thread Roberto Cavada
Version 1.2.2 of pygtkmvc has been released. Project homepage: Download: == About pygtkmvc == pygtkmvc is a fully Python-based implementation of the Model-View-Controller (MVC) and Observer p

Re: RPCXML hide implementation.

2008-08-26 Thread skip
x> Simple code: x> class RpcClass: x> def one(self): #visible by RPC, available as public for other class x> return "one" x> def two(self): #INVISIBLE by RPC, available as public for other x> class x> return "two" x> Server.register_instance(Rpc

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread John Machin
On Aug 26, 7:36 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Martin Marcher wrote: > > On 2008-08-26 00:32:20, cnb wrote: > >> Are dictionaries the same as hashtables? > > > Yes, but there is nothing in there that does sane collision handling > > like making a list instead of simply overwrit

Split function for host:port in standard lib

2008-08-26 Thread Michael Ströder
HI! Is there a function in the standard lib which can be used to split a string containg 'host:port' into a tuple (host,port) and also does this reliably for IPv6 addresses? Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python LDAP

2008-08-26 Thread Michael Ströder
Juan wrote: self.conn = ldap.initialize(self.host, self.port) > [..] LDAPError: (2, 'No such file or directory') You have to pass in a LDAP URI as documented here: http://python-ldap.sourceforge.net/doc/html/ldap.html#ldap.initialize Use of compability function ldap.open() is deprecated

Date type in win32com?

2008-08-26 Thread Haeyoung Kim
Hi. I'm migrating a VBScript into python. How should I convert Date type parameter in VBScript's COM interface with win32com? I couldn't find any answer yet... Thank you in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: logging exceptions

2008-08-26 Thread Rob Wolfe
Alexandru Mosoi napisał(a): > why doesn't logging throw any exception when it should? how do I > configure logging to throw exceptions? > > >>> try: > ... logging.fatal('asdf %d', '123') > ... except: > ... print 'this line is never printed' > ... [...] You need to subclass your handler and

Re: Split function for host:port in standard lib

2008-08-26 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 AFAIK port names cannot contain any colons, so python2.5's 'host:port' .rsplit(':') should do the job. On < 2.5 you probably need to do something like s = addr.rindex(':') host, port = addr[:s], addr[s+1:] Best, Manuel On Aug 26, 2008, at 1:31

What's your first choice if you have to write a C module for python?

2008-08-26 Thread 一首诗
Hi all, I read this interesting post comparing Boost.Python with Pyd: http://pyd.dsource.org/vsboost.html What's your opinion about it? What's your first choice when you have write a C/C++ module for Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Private attribute

2008-08-26 Thread Ken Starks
Steven D'Aprano wrote: def SomeClass(object): _gridsize = 0.8 The leading underscore tells callers that they change the attribute at their own risk. An even more Pythonic approach is to write your class that makes no assumptions about gridsize, and thus explicitly supports any reaso

Re: Split function for host:port in standard lib

2008-08-26 Thread Michael Ströder
Manuel Ebert wrote: On Aug 26, 2008, at 1:31 PM, Michael Ströder wrote: Is there a function in the standard lib which can be used to split a string containg 'host:port' into a tuple (host,port) and also does this reliably for IPv6 addresses? > AFAIK port names cannot contain any colons, so pyt

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread bearophileHUGS
[EMAIL PROTECTED]: > I read this interesting post comparing Boost.Python with Pyd: > http://pyd.dsource.org/vsboost.html > What's your opinion about it? > What's your first choice when you have write a C/C++ module for Python? That's not exactly a post. Pyd works well enough, it's easy to use and

Re: Sharing common memory space (In form of List) across the python processes.

2008-08-26 Thread Piyush Chechani
Hi, Thanks for your reply Terry. I am still not done with this problem. Please tell me can a server send a list object using socket programming to the requesting client? If yes, how? I am getting the following error "TypeError: send() argument 1 must be string or read-only buffer, not

Sharing common memory space (In form of List) across the python processes.

2008-08-26 Thread Piyush Chechani
Hi, Thanks for your reply Terry. I am still not done with this problem. Please tell me can a server send a list object using socket programming to the requesting client? If yes, how? I am getting the following error "TypeError: send() argument 1 must be string or read-only buffer, not

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread Lie
On Aug 26, 4:04 pm, "++imanshu" <[EMAIL PROTECTED]> wrote: > On Aug 26, 11:52 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > ++imanshu wrote: > > >     Wouldn't it be nicer to have 'in' return values (or keys) for both > > > arrays and dictionaries. Arrays and Dictionaries looked so similar

Re: property() usage - is this as good as it gets?

2008-08-26 Thread David Moss
Venerable Pythonistas, Looks like a pretty unanimous vote in favour of custom descriptor usage rather than the more generic property() BIF for my purposes. This is going to tidy and firm up my library code very nicely ;-) Thanks very much for your responses. Your assistance is greatly appreciate

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Diez B. Roggisch
John Machin wrote: > On Aug 26, 7:36 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Martin Marcher wrote: >> > On 2008-08-26 00:32:20, cnb wrote: >> >> Are dictionaries the same as hashtables? >> >> > Yes, but there is nothing in there that does sane collision handling >> > like making a lis

Re: property() usage - is this as good as it gets?

2008-08-26 Thread Diez B. Roggisch
> P.S. How did my post manage to ignite a mini flame war?! Because of the high resident troll quota in replies - which is created by just one rather annoying member of this community... Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing common memory space (In form of List) across the python processes.

2008-08-26 Thread D'Arcy J.M. Cain
On Tue, 26 Aug 2008 18:18:53 +0530 Piyush Chechani <[EMAIL PROTECTED]> wrote: > Please suggest how to share a in-memory list object across two different > programs? Perhaps you want to investigate XML-RPC. Check the docs for some example scripts for both client and server. P.S. Please drop the

Re: Filling in Degrees in a Circle (Astronomy)

2008-08-26 Thread Lie
On Aug 23, 6:12 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > The other night I surveyed a site for astronomical use by measuring the > altitude (0-90 degrees above the horizon) and az (azimuth, 0 degrees north > clockwise around the site to 360 degrees, almost north again) of obstacles, > trees. M

Re: Best way to set/get an object property

2008-08-26 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) But it's quite rare to see double-underscore "really private" attributes in Python code. It is considered to go against the spirit of the language. Not necessarily "against the spirit" - it's mostly than __name_mangling is only really useful when you want to pr

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread Uwe Schmitt
On 26 Aug., 14:19, 一首诗 <[EMAIL PROTECTED]> wrote: > Hi all, > > I read this interesting post comparing Boost.Python with Pyd: > > http://pyd.dsource.org/vsboost.html > > What's your opinion about it? > > What's your first choice when you have write a C/C++ module for Python? I prefer ctypes or f2p

Re: Programmatically exit the REPL

2008-08-26 Thread Alexander Schmolck
Without reading your post properly or having tried to do the same thing myself: I think you might want to have a look at ipython; it gives a better REPL and "embedding ipython" should give you plenty of hits as well. Matthew Fitzgibbons <[EMAIL PROTECTED]> writes: > I've got a pretty complex inte

Empece hacer un blog de python " http://binsd.wordpress.com/ "

2008-08-26 Thread R2T2
La verdad que me da un poco de vergüenza pero bueno no se como colaborar con la comunidad python entonces empecé hacer conjunto de entradas en mi blog para todos aquellos que recién se inician en python.Aun no llegue a explicar objetos pero estaría bueno que me digan si voy por buen camino :-). De

dynamically adding some of one module's functions to another

2008-08-26 Thread Gabriel Rossetti
Hello everyone, I'm trying to import some modules into another's namespace (network_utils) network_utils.py: import utils import constants as main_const from services import constants as srv_const from plugins import constants as plg_const # # Import all the message creation functions # f = di

Re: Need help with extension modules built in debug mode

2008-08-26 Thread bhood2
On Tue, 26 Aug 2008 08:20:44 +0200, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: > >> I've come to the conclusion that posting about Embedded Python on the >> Python forums is a complete waste of time. I hope I can get some >> useful insights here. > >(just curious, but what

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Martin
On Tue, Aug 26, 2008 at 9:52 AM, cnb <[EMAIL PROTECTED]> wrote: > On Aug 26, 9:43 am, Martin Marcher <[EMAIL PROTECTED]> wrote: >> On 2008-08-26 00:32:20, cnb wrote: >> >> > Are dictionaries the same as hashtables? >> >> Yes, but there is nothing in there that does sane collision handling >> like m

python multitask

2008-08-26 Thread [EMAIL PROTECTED]
Hi ! I want use many comands in same python script . I want to use openoffice and pyuno . I try this >>> cmdoo="openoffice.org -accept='socket,host=localhost,port=2002;urp;'" >>> subprocess.call(cmdoo, shell=True) but i need to execute another comand and need to stop subprocess Thank you ! -- http:

GUI programming with python

2008-08-26 Thread zamil
Hello Everyone It's my very first email to this group. i am a beginner programmer of python. it it possible to build Desktop application using python. Which IDE should i use for this purpose? I will be glad if anyone can give link of python ebook. Thanks in Advance Zamil -- http://mail.python.org

atomic increment

2008-08-26 Thread Alexandru Mosoi
how can i do an atomic read+increment? something like with lock: old = atomic_int atomic_int += 1 but in one operation -- http://mail.python.org/mailman/listinfo/python-list

Re: [ctypes-users] ctypes - loading 'librsvg-2-2.dll'

2008-08-26 Thread Martin (gzlist)
On 26/08/2008, Tim Grove <[EMAIL PROTECTED]> wrote: > Any ideas why a particular dll won't load on Windows XP Pro using > ctypes? I'm going to take a stab in the dark here and suggest it's because you have multiple (different) copies of iconv.dll on your PATH. > l=CDLL(r'D:\SILSign\librsvg-2-2.

libxml2dom - parsing maligned html

2008-08-26 Thread bruce
Hi... I'm using quick test with libxml2dom === import libxml2dom aa=libxml2dom.parseString(foo) ff=libxml2dom.toString(aa) print ff === -- when i start, foo is: . . . --- when i print ff it's:

python portable installation?

2008-08-26 Thread luismi
Hi, I have searched the online manuals, faqs and forums, but i haven't found a satisfactory explanation ... most probably my fault ;) I have found 2 projects, one commercial and another free, that deal with the installation and running of python code on portable/removable devices, my questions a

Re: libxml2dom - parsing maligned html

2008-08-26 Thread Paul Boddie
On 26 Aug, 17:28, "bruce" <[EMAIL PROTECTED]> wrote: > so it's as if the parseString only reads the initial "html" tree. i've > reviewed as much as i can find regarding libxml2dom to try to figure out how > i can get it to read/parse/handle both html trees/nodes. Maybe there's some possibility to

Re: atomic increment

2008-08-26 Thread Diez B. Roggisch
Alexandru Mosoi wrote: > how can i do an atomic read+increment? something like > > with lock: >old = atomic_int >atomic_int += 1 > > but in one operation As above - the lock (under the assumption that it is actually a threading.Lock) will ensure that. Diez -- http://mail.python.org/ma

Re: libxml2dom - parsing maligned html

2008-08-26 Thread Stefan Behnel
bruce wrote: > I'm using quick test with libxml2dom > > === > import libxml2dom > > aa=libxml2dom.parseString(foo) > ff=libxml2dom.toString(aa) > > print ff > === > > -- > when i start, foo is: > > > > > > > > . > . > . > > >

Re: python portable installation?

2008-08-26 Thread Fredrik Lundh
luismi wrote: I have searched the online manuals, faqs and forums, but i haven't found a satisfactory explanation ... most probably my fault ;) I have found 2 projects, one commercial and another free, that deal with the installation and running of python code on portable/removable devices, my

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >Martin Marcher wrote: > >> On 2008-08-26 00:32:20, cnb wrote: >>> Are dictionaries the same as hashtables? . . . >Python does not have a "one key maps

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Fredrik Lundh
Martin Marcher wrote: Are dictionaries the same as hashtables? Yes, but there is nothing in there that does sane collision handling like making a list instead of simply overwriting. are you sure you know what "collision handling" means in this context? -- http://mail.python.org/mailman/li

Re: File copying from a menu

2008-08-26 Thread Brandon
Ok, below is a portion of the code that first (near as I can tell because I had nothign to do with desgining the program) sets up the menu (setupMenuBar) and then adds the commands to be used with the items: def setupMenuBar(self): menubar = self.menuBar() file_ = menubar.addMenu

Re: GUI programming with python

2008-08-26 Thread Alan Franzoni
zamil was kind enough to say: [cut] If your needs are very basic, you can stick with the tk module that comes with python. It's not really feature-packed, but it's maintained and pretty cross-platform. Otherwise, you can pick any supported widget set you like and use the proper python bindings.

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread Ulrich Eckhardt
一首诗 wrote: > I read this interesting post comparing Boost.Python with Pyd: > > http://pyd.dsource.org/vsboost.html > > What's your opinion about it? > > What's your first choice when you have write a C/C++ module for Python? There is no such thing as a C/C++ language. Seriously, both are really

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Fredrik Lundh
Diez B. Roggisch wrote: I don't know the exact names of the involved structures - I named them liberally from my understanding of how associative arrays based on hashing are implemented. But the below code shows that hash-collisions can occur without corrupting data http://en.wikipedia.org/wik

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Diez B. Roggisch
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >>Martin Marcher wrote: >> >>> On 2008-08-26 00:32:20, cnb wrote: Are dictionaries the same as hashtables? > . > . > . >>Python does not have a "one key maps to a list of values"-semantics - >

Best idiom for looping over input?

2008-08-26 Thread mh
What's the best Python idiom for this C construct? while ((x = next()) != END) { } Now I'm doing x = next() while x != END: x = next() There's not an iterator for this function, or I would just use for x in ... Many TIA! Mark -- Mark Har

Newbie needs help

2008-08-26 Thread frankrentef
Greetings all, I'm wanting to maintain what values in one file and call them in another. The purpose being to keep a single location where url's, login's and passwords can be maintained, then called as needed from another file. In file #1 I have... import time import os import sys url = 'http:

Re: Return a string result with out breaking loop

2008-08-26 Thread Andrew
Hi I have done this without error :D Yield returns the result I am looking for... however it does not continue looping. It does the same thing as return would any suggestions my code is as follows serveraddr = ('', ) srvr = ThreadingServer(serveraddr, SimpleXMLRPCRequestHandler, allow_

Re: Programmatically exit the REPL

2008-08-26 Thread Matthew Fitzgibbons
Alexander Schmolck wrote: Without reading your post properly or having tried to do the same thing myself: I think you might want to have a look at ipython; it gives a better REPL and "embedding ipython" should give you plenty of hits as well. Thanks for the tip; I hadn't heard of ipython befor

Re: Best idiom for looping over input?

2008-08-26 Thread Jean-Paul Calderone
On Tue, 26 Aug 2008 16:42:30 GMT, [EMAIL PROTECTED] wrote: What's the best Python idiom for this C construct? while ((x = next()) != END) { } Now I'm doing x = next() while x != END: x = next() There's not an iterator for this function, or I would ju

Re: Newbie needs help

2008-08-26 Thread Eric Wertman
Is the loginout file named loginout.py ? It needs to be for the import to work. If the import works, you have to refer to those variables within the right namespace, ie : loginout.url, loginout.adminlogin, etc. On Tue, Aug 26, 2008 at 12:46 PM, frankrentef <[EMAIL PROTECTED]> wrote: > Gree

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Chris Mellon
On Tue, Aug 26, 2008 at 11:12 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Martin Marcher wrote: > >>> Are dictionaries the same as hashtables? >> >> Yes, but there is nothing in there that does sane collision handling >> like making a list instead of simply overwriting. > > are you sure you know

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread norseman
frankentux wrote: Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import TableRow,TableCell from odf.text import P doc = load("/tmp/match_d

Re: Best idiom for looping over input?

2008-08-26 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: What's the best Python idiom for this C construct? while ((x = next()) != END) { } iter is your friend: for x in iter(next, END): ... details: >>> help(iter) Help on built-in function iter in module __builtin__: iter(...) ite

sum up numbers in a list

2008-08-26 Thread sharon kim
hi all, i have a list, for example; >>> L=[] >>> L.append('10') >>> L.append('15') >>> L.append('20') >>> len(L) 3 >>> print L ['10', '15', '20'] is there a way to sum up all the numbers in a list? the number of objects in the list is vary, around 50 to 60. all objects are 1 to 3 digit positive

Re: Return a string result with out breaking loop

2008-08-26 Thread Fredrik Lundh
Andrew wrote: Yield returns the result I am looking for... however it does not continue looping. It does the same thing as return would the XML-RPC protocol doesn't really support your use case; for each call, the client issues a complete request package, and the server produces a complete r

Reading from text file

2008-08-26 Thread A. Joseph
I want to read from text file, 25 lines each time i press enter key, just like the python documentation. i`m using Python 2.5, Windows XP Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: sum up numbers in a list

2008-08-26 Thread Fredrik Lundh
sharon kim wrote: i have a list, for example; >>> L=[] >>> L.append('10') >>> L.append('15') >>> L.append('20') >>> len(L) 3 >>> print L ['10', '15', '20'] is there a way to sum up all the numbers in a list? the number of objects in the list is vary, around 50 to 60. all objects are 1

Re: Reading from text file

2008-08-26 Thread Fredrik Lundh
A. Joseph wrote: I want to read from text file, 25 lines each time i press enter key, just like the python documentation. you can use pydoc's pager from your program: import pydoc text = open(filename).read() pydoc.pager(text) -- http://mail.python.org/mailman/listinfo/python-

Re: sum up numbers in a list

2008-08-26 Thread c james
>>> L=['10','15','20'] >>> sum(int(x) for x in L) 45 or >>> sum(map(int,L)) 45 sharon kim wrote: hi all, i have a list, for example; >>> L=[] >>> L.append('10') >>> L.append('15') >>> L.append('20') >>> len(L) 3 >>> print L ['10', '15', '20'] is there a way to sum up all the numbers in

  1   2   3   >