Re: Since there was talk of if-then-else not being allowed in lambda expressions, the following is from "Dive into Python"

2006-07-20 Thread Peter Otten
Casey Hawthorne wrote: > Since there was talk of if-then-else not being allowed in lambda > expressions, the following is from "Dive into Python" > > The and-or conditional expression trick from page 41 of "Dive into > Python" > > Wrap the arguments in lists and then take the first element. > >

Re: function v. method

2006-07-20 Thread Alex Martelli
danielx <[EMAIL PROTECTED]> wrote: > > ...and source code... > > *shudders* What happened to all the goodness of abstraction? Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking File permissions

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script Without knowing what your precise needs are, the best way is to open the file and try to read from it. If that succeeds, then you've got rea

Re: compiling 2.3.5 on ubuntu

2006-07-20 Thread Anthony Baxter
On 7/17/06, Py PY <[EMAIL PROTECTED]> wrote: Sorry to be a pest but is there anybody that could help me understanda) if any of this is a problem; and b) where I can learn how to fix it. sudo apt-get build-dep python2.3 then rebuild. -- http://mail.python.org/mailman/listinfo/python-list

How to use pdb?

2006-07-20 Thread tron . thomas
I am trying to figure out how to use the pdb module to debug Python programs, and I'm having difficulties. I am pretty familiar with GDB which seems to be similar, however I cannot even get the Python debugger to break into a program so I can step through it. I wrote a simple program and below is

Re: Note on PEP 299

2006-07-20 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I don't like much the syntax of: > if __name__ == '__main__': > > Some time ago I have read this PEP: > http://www.python.org/dev/peps/pep-0299/ > > And why it was refused: > http://mail.python.org/pipermail/python-dev/2006-March/062955

change default install directory when using bdist_rpm

2006-07-20 Thread krithika . sridhar
Hi, I'm using : python setup.py bdist_rpm to create an rpm package to distribute my python app on linux. When i install the rpm, the files are installed in /usr/share/python/site-packages/. directory by default. How do i change the installation directory?? Thanks, krithika -- http://mail

Since there was talk of if-then-else not being allowed in lambda expressions, the following is from "Dive into Python"

2006-07-20 Thread Casey Hawthorne
Since there was talk of if-then-else not being allowed in lambda expressions, the following is from "Dive into Python" The and-or conditional expression trick from page 41 of "Dive into Python" Wrap the arguments in lists and then take the first element. >>> a = "" >>> b = "second" >>> (1 and [a

Re: function v. method

2006-07-20 Thread fuzzylollipop
danielx wrote: > Bruno Desthuilliers wrote: > > danielx wrote: > > > At first I was going to post the following: > > > > > > > > > > > (snip) > > > > > > > > > > > > but then I tried this: > > > > > > > > res = Foo.__dict__['func'] > > res is dan > > > > > > True > > > > > > And it all s

Re: Accessors in Python (getters and setters)

2006-07-20 Thread fuzzylollipop
Ed Jensen wrote: > Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > > Ah, you mean like in JAVA > > Java is not an acronym. That is: it's "Java", not "JAVA". > > > where the compiler prevents you from accessing > > private variables, but the runtime allows access to these very variables > > via refl

Re: Using python code from Java?

2006-07-20 Thread Ray
fortepianissimo wrote: > > Waiting for jython2.3 might be an option, too - things are pretty much > > on the move right now. > > Any idea how soon that will be? If you just want to use Java to call Python, you can use Jython 2.1 too. Jython 2.2 is in (active) development right now, and hopefully a

Re: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-20 Thread Larry Hastings
Delaney, Timothy (Tim) wrote: > Could you raise this as a bug on Sourceforge? Done; it is "request ID" 1526203. https://sourceforge.net/tracker/index.php?func=detail&aid=1526203&group_id=5470&atid=105470 Cheers, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

RE: Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-20 Thread Delaney, Timothy (Tim)
Larry Hastings wrote: > Under Python 2.5, both beta 1 and beta 2, it dumps the results to the > command shell, but *also* prints this: > > Exception exceptions.AttributeError: "'NoneType' object has no > attribute 'append'" in > ignored Could you raise this as a bug on Sourceforge? Cheers, Ti

Re: using names before they're defined

2006-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hiya > > Could you just talk me through this... is it: > > >>schema = {'turbine1': {'class': 'Turbine', >> 'upstream' : ('frobnicator2',), >> 'downstream' : () # nothing, >> }, >> 'frobnicato

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Ant a écrit : > Came across this article this afternoon - thought it may be of interest > to some of those following this thread... > > http://www.devx.com/opensource/Article/31593/0/page/2 > Yeah. Presenting name mangling as the usual way to have 'private' attributes, then implementing (costly)

Re: ConfigParser: what read('non-existent-filename') returns in 2.3.x?

2006-07-20 Thread Danil Dotsenko
Danil Dotsenko wrote: > Chris Lambacher wrote: >> On Thu, Jul 20, 2006 at 10:50:40AM -0700, Danil Dotsenko wrote: >>> Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's >>> SuperKaramba widget. >>> (http://www.kde-look.org/content/show.php?content=32185) >>> >>> I was using 2.4.x

Re: [OT] Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Dennis Lee Bieber a écrit : > On Thu, 20 Jul 2006 12:52:52 +0200, Bruno Desthuilliers > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>Granted. Actually, it *was* a typo - but it happened to also make sens, >>so I decided it was not a typo !-) >> > > Ah... One of th

Problem with cx_freeze / FreezePython

2006-07-20 Thread Kevin Walzer
I am trying to build a simple "hello.py" script with cx_freeze, but am not having any luck. Every time I run the FreezePython utility I get this error message: Traceback (most recent call last): File "/Users/kevin/Desktop/cx_Freeze-3.0.2/initscripts/ConsoleKeepPath.py", line 15, in ? exec co

Re: Py2exe & (Py)QT4

2006-07-20 Thread David Boddie
[EMAIL PROTECTED] wrote: > I'm having trouble using Py2exe with a PyQT-based python project. Or > possibly I'm having a problem with PyQT and Py2exe makes it apparent. > Whichever it is, I run into trouble with importing QtCore and QtGui. > The error reported is: > > Traceback (most recent call la

Re: function v. method

2006-07-20 Thread danielx
Bruno Desthuilliers wrote: > danielx wrote: > > Bruno Desthuilliers wrote: > > > >>danielx wrote: > > (snip) > >>>which gets me thinking again about > >>>the stuff I self-censored. Since the dot syntax does something special > >>>and unexpected in my case, > >> > >>"unexpected" ? Did you ever wond

Re: ConfigParser: what read('non-existent-filename') returns in 2.3.x?

2006-07-20 Thread Danil Dotsenko
Chris Lambacher wrote: > On Thu, Jul 20, 2006 at 10:50:40AM -0700, Danil Dotsenko wrote: >> Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's >> SuperKaramba widget. >> (http://www.kde-look.org/content/show.php?content=32185) >> >> I was using 2.4.x python docs as reference and >>

Re: using names before they're defined

2006-07-20 Thread Larry Bates
I don't know if you saw my earlier post but something like this has worked for me. What about something like: supply = supply() compressor = compressor(supply) combuster1= combuster(compressor) combuster2= combuster(compressor) compressor.append(combuster1) compressor.append(combuster2) or perha

Re: question about what lamda does

2006-07-20 Thread danielx
Bruno Desthuilliers wrote: > danielx wrote: > (snip) > > > Python's lambda really can't be as powerful as Lisp's because Python > > does not have expressions that do case analysis (this is not lambda's > > fault, of course ;). The reason is that you really want to put each > > case on its own set

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Gerhard Fiedler a écrit : > On 2006-07-20 09:40:31, Bruno Desthuilliers wrote: > > >>>I'm not sure, but there's one thing that has a potential to be the real >>>issue: what's the common way to create a property that is read-write >>>for the implementation and "read-only" for the interface? >> >>

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Diez B. Roggisch a écrit : >> You mean: >> >> class Pythonic(object): >> def __init__(self): >> self._is_active = True >> >> @apply >> def is_active(): >> def fget(self): return self._is_active >> def fset(self): raise SomeException('sorry, read-only') >> return

Re: ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

2006-07-20 Thread Damjan
> I am using RedHat Linux 4. and I developed an oracle 10g based > application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and > Python 2.3.4. > > When I run the application through direct console connection, It works > perfect. > > But, when I schedule a crontab job to run the applica

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Ed Jensen
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >> Java is not an acronym. That is: it's "Java", not "JAVA". > > Now THAT was an important information RIGHT on topic. It was not meant offensively. >> Java does not allow access to private members via reflection. > > For somebody nitpicking on natur

IronPython and scipy/pyExcelerator

2006-07-20 Thread tkpmep
I'm looking forward to the release IronPython, primarily for its IDE. I currently use scipy and pyExcelerator to crunch numbers and write them to Excel: does can these packages be used with IronPython as well? Thanks in advance Thomas Philips -- http://mail.python.org/mailman/listinfo/python-li

Re: ConfigParser: what read('non-existent-filename') returns in 2.3.x?

2006-07-20 Thread Chris Lambacher
On Thu, Jul 20, 2006 at 10:50:40AM -0700, Danil Dotsenko wrote: > Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's > SuperKaramba widget. > (http://www.kde-look.org/content/show.php?content=32185) > > I was using 2.4.x python docs as reference and > ConfigParser.read('non-existen

Re: ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

2006-07-20 Thread Bill Scherer
gmax2006 wrote: >Hi, > >I am using RedHat Linux 4. and I developed an oracle 10g based >application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and >Python 2.3.4. > >When I run the application through direct console connection, It works >perfect. > >But, when I schedule a crontab job to

Re: Augument assignment versus regular assignment

2006-07-20 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-07-19, Terry Reedy <[EMAIL PROTECTED]> wrote: >> >> But I won't. The amount of duplication that can be factored out with >> augmented assignment depends on the granularity of operations. > > I can agree with th

Re: using names before they're defined

2006-07-20 Thread davehowey
Hiya Could you just talk me through this... is it: > schema = {'turbine1': {'class': 'Turbine', >'upstream' : ('frobnicator2',), >'downstream' : () # nothing, >}, > 'frobnicator2' : {'class' : 'Frobnicator', >

ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

2006-07-20 Thread gmax2006
Hi, I am using RedHat Linux 4. and I developed an oracle 10g based application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and Python 2.3.4. When I run the application through direct console connection, It works perfect. But, when I schedule a crontab job to run the application, It lo

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > >>point 2 : so anyone *can* "illegimately tampering with an object's > >>internal data" at will. > >> > > > >And this is robust how? > > > > You can do just the same in Java or C++. >

Re: Using python code from Java?

2006-07-20 Thread Nick Vatamaniuc
I can't think of any project that does that. Calling stuff from Java is not easy to beging with you have to go through the native interface (JNI) anyway. I would suggest instead to create some kind of a protocol and let the applications talk using an external channel (a FIFO pipe file, a socket or

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
Donn Cave wrote: [...] > > Oh, excellent - the string module is dead, long live > the string module! I can replace string.join with > str.join, and never have to defile my code with that > ' '.join(x) abomination. > >>> lst = ['Steve', 'Holden'] >>> str.join(' ', lst) 'Steve Holden' >>> J

wx.ListCtrl - I do not see the inserted item

2006-07-20 Thread Laszlo Nagy
This is a ListCtrl descendant: class MegaListCtrl(wx.ListCtrl): def InsertImageStringItem(self, index, label, imageIndex): imageIndex = self.imagelists[wx.IMAGE_LIST_SMALL].GetIndexByName(imageIndex) print index,imageIndex,label,imageIndex super(MegaListCtrl,sel

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Steve Holden
Kilicaslan Fatih wrote: [...] > Dear All, > > I changed the mode of the files before copying them. > So the problem is solved as follows: > > SOLUTION: > > def run(self, event): > cmd_out = self.A_com() > if App.runF != "": > os.mkdir('C:\copiedFiles')

Re: using capicom with python

2006-07-20 Thread stéphane bard
thank's for all roger sorry to answer so late :-D Roger Upole a écrit : > "stéphane bard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Hi all, >> Has anyone ever used Python to work with Certificate Services in >> Windows? I'm trying to capicom dll with pywin32. >> >> >> I've fou

Re: Using python code from Java?

2006-07-20 Thread fortepianissimo
Diez B. Roggisch wrote: > fortepianissimo schrieb: > > Is there a solution to enable Java programmers to call functions > > written in Python? Any wrapper generator that wraps Python code into > > some Java-callable form? > > > > I briefly looked at Jython, but if I understand it right, it didn't

ConfigParser: what read('non-existent-filename') returns in 2.3.x?

2006-07-20 Thread Danil Dotsenko
Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's SuperKaramba widget. (http://www.kde-look.org/content/show.php?content=32185) I was using 2.4.x python docs as reference and ConfigParser.read('non-existent-filename') returns [] in 2.4.x One user with 2.3.x reported an error stem

Re: Using python code from Java?

2006-07-20 Thread Diez B. Roggisch
fortepianissimo schrieb: > Is there a solution to enable Java programmers to call functions > written in Python? Any wrapper generator that wraps Python code into > some Java-callable form? > > I briefly looked at Jython, but if I understand it right, it didn't > support full power of Python 2.3.x

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Nick Vatamaniuc
Use __slots__ they will simply give you an error. But at the same time I don't think they are inheritable and in general you should only use slots for performance reasons (even then test before using). Or you could also simulate a __slots__ mechanism the way you are doing i.e. checking the attribu

Using python code from Java?

2006-07-20 Thread fortepianissimo
Is there a solution to enable Java programmers to call functions written in Python? Any wrapper generator that wraps Python code into some Java-callable form? I briefly looked at Jython, but if I understand it right, it didn't support full power of Python 2.3.x (which I need). Any suggestion is w

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 09:40:31, Bruno Desthuilliers wrote: >> I'm not sure, but there's one thing that has a potential to be the real >> issue: what's the common way to create a property that is read-write >> for the implementation and "read-only" for the interface? > > class Foo(object): > @apply >

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Ant
Came across this article this afternoon - thought it may be of interest to some of those following this thread... http://www.devx.com/opensource/Article/31593/0/page/2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: >>point 2 : so anyone *can* "illegimately tampering with an object's >>internal data" at will. >> > >And this is robust how? > You can do just the same in Java or C++. >>> >>> >>>OMG! >> >>It's common knowledge. >

Re: strange error when importing a module

2006-07-20 Thread Robin Becker
Robin Becker wrote: > I'm trying to understand the following strangeness > > C:\code\rlextra\ers>python > Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> from rlextra.utils.SimpleXMLRPCSe

Re: text representation of HTML

2006-07-20 Thread Tim Williams
On 20 Jul 2006 15:12:27 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > Ksenia Marasanova wrote: > > i want to send plain text alternative of html email, and would prefer > > to do it automatically from HTML source. > > Any hints? > > Use htmllib: > > >>> import htmllib, formatter, StringIO > >>> de

Re: Coding style

2006-07-20 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2006-07-19, Donn Cave <[EMAIL PROTECTED]> wrote: ... > > http://groups.google.com/group/comp.lang.python/msg/2de5e1c8384c0360 > > > > It's lengthy but very readable, and for me it has that quality of > > exposition where

Re: Depricated String Functions in Python

2006-07-20 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Anoop wrote: > > Thanks Stefen > > > > let me be more specific how would i have to write the following > > function in the deprecated format > > > > map(string.lower,list) > > > To avoid the deprecated usage you would us

strange error when importing a module

2006-07-20 Thread Robin Becker
I'm trying to understand the following strangeness C:\code\rlextra\ers>python Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from rlextra.utils.SimpleXMLRPCServer import SimpleXMLRPCServer T

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > > (snip) > >You use accessors when you need to control access to a data attribute. > > Indeed. And when you don't need too ? (the second 'o' is not a typo) > > >>> > >>> > >>>You make the attribute

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Diez B. Roggisch
> You mean: > > class Pythonic(object): > def __init__(self): > self._is_active = True > > @apply > def is_active(): > def fget(self): return self._is_active > def fset(self): raise SomeException('sorry, read-only') > return property(**locals()) Neat! That sli

Re: Question regarding commit/backout of a message using the pymqi module

2006-07-20 Thread JonS
Andrew Robert wrote: > Hi everyone, > > Could someone help explain what I am doing wrong in > this code block? > > This code block is an excerpt from a larger file that receives > transmitted files via IBM WebSphere MQSeries an drops it to the local > file system. > > Transmission of the file work

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > > > Well, range is a function in the current implementation, although its > > > usage is similar to that one would get if it were a class, particularly > > > a subclass of list or one p

Re: Python linker

2006-07-20 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I develop shareware applications that need to be extremely slim (less > than 1 MB is preferable). > > Delphi applications easily meet this requirement and I can expect end > users to download the .NET framework (if they don't already have it!). > > However, I cannot

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Python linker

2006-07-20 Thread Alex Martelli
Ben Sizer <[EMAIL PROTECTED]> wrote: > Sion Arrowsmith wrote: > > Er, what? How are you generating your standalone executables? What > > size is "acceptable"? python24.dll is only 1.8M -- surely on any > > non-embedded platform these days 1.8M isn't worth bothering about. > > And since you mention

Re: range() is not the best way to check range?

2006-07-20 Thread Paul Boddie
Alex Martelli wrote: > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > Well, range is a function in the current implementation, although its > > usage is similar to that one would get if it were a class, particularly > > a subclass of list or one providing a list-style interface. With such a > > cla

Note on PEP 299

2006-07-20 Thread bearophileHUGS
I don't like much the syntax of: if __name__ == '__main__': Some time ago I have read this PEP: http://www.python.org/dev/peps/pep-0299/ And why it was refused: http://mail.python.org/pipermail/python-dev/2006-March/062955.html I think the name of the standard main function may be just main(), s

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > > > range() and xrange() are functions. You are suggesting that 2 > > *functions* should acquire a __contains__ method each? I trust not. > > Well, range is a function in the current implementation, although its > usage is similar to

Re: text representation of HTML

2006-07-20 Thread Duncan Booth
Ksenia Marasanova wrote: > I am looking for a library that will give me very simple text > representation of HTML. > For example >TitleThis is a test > > will be transformed to: > > Title > > This is a > test > > > i want to send plain text alternative of html email, and would prefer > to do

Re: question about what lamda does

2006-07-20 Thread Bruno Desthuilliers
danielx wrote: (snip) > Python's lambda really can't be as powerful as Lisp's because Python > does not have expressions that do case analysis (this is not lambda's > fault, of course ;). The reason is that you really want to put each > case on its own set of lines. This enhances readability at th

Re: text representation of HTML

2006-07-20 Thread garabik-news-2005-05
Ksenia Marasanova <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking for a library that will give me very simple text > representation of HTML. > For example > TitleThis is a test > > will be transformed to: > > Title > > This is a > test > > > i want to send plain text alternative of html ema

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > (snip) >You use accessors when you need to control access to a data attribute. Indeed. And when you don't need too ? (the second 'o' is not a typo) >>> >>> >>>You make the attribute private/protected. >> >>doh :( >> >>Let's talk ab

Re: Encode filenames to safe format

2006-07-20 Thread Amit Khemka
On 7/20/06, Dara Durum <[EMAIL PROTECTED]> wrote: > Hi ! > > I want to encode filenames to safe format, like in browser url (space -> > %20, etc.). > What the module and function name that helps me in this project ? > import urllib urllib.quote('file name') cheers, amit -- Amit Khemka -- o

Re: Help Needed. Removing a Folder Problem

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: SOAPy Question

2006-07-20 Thread gregarican
Please disregard, as I googled my way to the answer. I used SOAPProxy to specify the information I needed to get out to the external SOAP service. All is well and away we go :-) gregarican wrote: > I apologize in advance for not googling in depth enough :-) I am > looking for use Python's SOAP imp

Py2exe & (Py)QT4

2006-07-20 Thread shane . external
I'm having trouble using Py2exe with a PyQT-based python project. Or possibly I'm having a problem with PyQT and Py2exe makes it apparent. Whichever it is, I run into trouble with importing QtCore and QtGui. The error reported is: Traceback (most recent call last): File "xmlEdit.py", line 3, i

Re: Checking File permissions

2006-07-20 Thread Larry Bates
Note: You really don't have to post the same question 3 times (2 in response to yourself). import os if os.path.exists(pathname): To see if a file is writeable: import stat def iswriteable(path): mode=os.stat(path)[stat.ST_mode] return bool(stat.S_IMODE(mode) & stat.S_IWRITE) Larr

Re: Checking File permissions

2006-07-20 Thread Avell Diroll
Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script You can check the os module (os.stat comes to mind). For an exemple you can have a look at : http://www.pixelbeat.org/talks/python/ls.py Regards, Avell -- http://mail.py

Re: Depricated String Functions in Python

2006-07-20 Thread riquito
Steve Holden ha scritto: > Anoop wrote: > > Thanks Stefen > > > > let me be more specific how would i have to write the following > > function in the deprecated format > > > > map(string.lower,list) > > > To avoid the deprecated usage you would use the unbound method of the > str type (that's the

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Bruno Desthuilliers
Matthew Wilson wrote: > On Thu 20 Jul 2006 04:32:28 AM EDT, Bruno Desthuilliers wrote: (snip) > >>>class C1(C): >>> >>>standard_attributes = ['a1', 'a2'] >> >>DRY violation here. And a potential problem with inheritance (as always >>with class attributes). > > > Considering I had to

subprocess module

2006-07-20 Thread placid
Hi all, If someone could give me an example of creating a subprocess (on Windows) using the subprocess module and Popen class and connecting to its stdout/stdin file handles. I googled for a bit but the only example i found was here ; http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438119

Re: Help Needed. Removing a Folder Problem

2006-07-20 Thread Larry Bates
Note the error is permission denied. I would guess that either the file has read-only flag set or perhaps the '' program is still running and has the file open in a separate thread so you can't delete the directory until it has completed. You should take a look at the subprocess module and us

Re: question about what lamda does

2006-07-20 Thread nephish
hey thanks for that last post, although some of it was a bit over my head. i think i am getting more of the differences here. thanks again, sk danielx wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > i have been learning python for the past few months, but i can seem to > > get what exactly a

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Matthew Wilson
On Thu 20 Jul 2006 04:32:28 AM EDT, Bruno Desthuilliers wrote: >> self.__dict__[name] = value > Make it: > object.__setattr__(self, name, value) > > Your approach will lead to strange results if you mix it with properties > or other descriptors... Thanks! >> cl

Encode filenames to safe format

2006-07-20 Thread Dara Durum
Hi !I want to encode filenames to safe format, like in browser url (space -> %20, etc.).What the module and function name that helps me in this project ?Thanx for it:dd -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > > >>mystilleef wrote: > >> > >>>Bruno Desthuilliers wrote: > >>> > >>> > mystilleef wrote: > >> > >>(snip) > >> > >>>Of course using setters for the sake of just using them is pointless. > >> > >>Inde

Re: Depricated String Functions in Python

2006-07-20 Thread Duncan Booth
Anoop wrote: > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) What you just wrote is the deprecated format. There are plenty of ways to write it in an undeprecated format. The simplest is probably: [ s.lower()

Re: Depricated String Functions in Python

2006-07-20 Thread Simon Forman
Anoop wrote: > Thanks Stefen > > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) > > Thanks Anoop Ah. This is easy enough: lower_list = [s.lower() for s in str_list] Or, if you really like map() (or really don't like

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
Anoop wrote: > Thanks Stefen > > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) > To avoid the deprecated usage you would use the unbound method of the str type (that's the type of all strings): >>> lst = ['Steve

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

SOAPy Question

2006-07-20 Thread gregarican
I apologize in advance for not googling in depth enough :-) I am looking for use Python's SOAP implementation to pull some retail pricing data for a work project. Our Internet access goes through an authenticating proxy server. Can I access information in this scenario using SOAPy? I have seen case

Re: Depricated String Functions in Python

2006-07-20 Thread Anoop
Thanks Stefen let me be more specific how would i have to write the following function in the deprecated format map(string.lower,list) Thanks Anoop Stefan Behnel wrote: > Anoop wrote: > > Can any one help me out with the various depricated string functions > > that is followed in Python. > > >

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Gerhard Fiedler wrote: (snip) > > I'm not sure, but there's one thing that has a potential to be the real > issue: what's the common way to create a property that is read-write for > the implementation and "read-only" for the interface? class Foo(object): @apply def _imp(): def fget(self

Re: questions to anyone who uses wxPython

2006-07-20 Thread [EMAIL PROTECTED]
damacy wrote: > hello. i'm using wxPython as my GUI package and whenever my program > executes a long process which takes at least 2 or 3 seconds, the user > interface gets corrupted while executing the progrocess during the > period. Hi Darnacy, I had the same issue and used wxProcess to run th

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: (snip) > > __monitor_event is not supposed to be a write accessor. My point was > show how you can change the state of an object internally without > needing external access to it. Since some people are surprisingly > claiming it is not possible. I failed to see anyone making su

Re: Recursive function returning a list

2006-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] wrote: > > [...] > >>>Sorry, but I kinda agree with Boris here. >> >>On what ? > > > On the argument that you are (implicitly?) disagreeing with him it's getting messy - too much level of indirection !-) > on, > obv

Re: using names before they're defined

2006-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: (snip) > brings me onto another question that has been bugging me, which is, if > I want to create components (as object instances) at run time (rather > than through a python code imported in), how do I do this? i.e. if I > hardcoded something like > turbine1 = turbine(...

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Diez B. Roggisch
> Lol. I actually did *un*learn the hard way. > > Mystilleef, I've started programing 17 years ago, and have done it > professionnaly for almost 10 years now. I do not pretend to be a good > programmer, but please believe that I do know my job. I've read the Book > too, I've tried applying it blin

Re: wxPython: wxStaticBitmap and large images

2006-07-20 Thread Will McGugan
Roger Miller wrote: > I have a WxPython app that displays images that are typically around > 600x600 pixels. I use a wxStaticBitmap, which appears to work fine on > Windows XP. However the documentation states that a StaticBitmap "... > is meant for display of the small icons in the dialog boxes a

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Steve Holden
Gerhard Fiedler wrote: > On 2006-07-20 04:15:33, Steve Holden wrote: > > >>mystilleef wrote: >>[...] >> >>>I don't know it's your code not mine. >>> >>>class Robust(object): >>> >>> def __init__(self): >>> # Arbitrarily changing this state to False will crash app or >>> will >>>

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 04:15:33, Steve Holden wrote: > mystilleef wrote: > [...] >> >> I don't know it's your code not mine. >> >> class Robust(object): >> >> def __init__(self): >> # Arbitrarily changing this state to False will crash app or >> will >> # corrupt the whol

Re: using names before they're defined

2006-07-20 Thread davehowey
Paddy, thanks for your mail. > In Digital electronics we have what are called netlists, (and also > component lists) yes, years back I did a 3rd year project on a 'logic simulator' which used the kind of thing you are talking about. I think spice does as well. Fortunately my problem is a little

  1   2   >