Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Fri, 27 Oct 2006 17:35:58 +, Antoon Pardon wrote: > On 2006-10-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> But in this specific instance, I don't see any advantage to explicitly >> testing the length of a list. Antoon might think that is sufficiently >> polymorphic, but it isn't. H

what are the most frequently used functions?

2006-10-28 Thread Xah Lee
I had a idea today. I wanted to know what are the top most frequently used functions in the emacs lisp language. I thought i can write a quick script that go thru all the elisp library locations and get a word-frequency report i want. I started with a simple program: http://xahlee.org/p/titus/cou

Re: Restricting import file lookup for pyd, dll, ...

2006-10-28 Thread Fredrik Lundh
Magnus Lycka wrote: >> That's because I'm using Python through another application, via the >> pywin32 extensions. When that other application starts, it performs >> several thousands of file requests (we're talking 4,500, roughly) in >> the Python installation, locations where there are Python fi

Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Fri, 27 Oct 2006 18:22:28 +, Antoon Pardon wrote: >>> And how do I express that a number has to be greater than >>> 100 into a Nothing vs Something dichotomy? Declare all >>> greater numbers as Something and the rest as Nothing? >> >> Well, would you declare numbers less than 100 False? >

Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Fri, 27 Oct 2006 11:25:09 -0700, Carl Banks wrote: > Steven D'Aprano wrote: >> But in this specific instance, I don't see any advantage to explicitly >> testing the length of a list. Antoon might think that is sufficiently >> polymorphic, but it isn't. He cares whether the object has zero _leng

Where do nested functions live?

2006-10-28 Thread Steven D'Aprano
I defined a nested function: def foo(): def bar(): return "bar" return "foo " + bar() which works. Knowing how Python loves namespaces, I thought I could do this: >>> foo.bar() Traceback (most recent call last): File "", line 1, in ? AttributeError: 'function' object has no att

Re: Where do nested functions live?

2006-10-28 Thread Fredrik Lundh
Steven D'Aprano wrote: > I defined a nested function: > > def foo(): > def bar(): > return "bar" > return "foo " + bar() > > which works. Knowing how Python loves namespaces, I thought I could do > this: > foo.bar() > Traceback (most recent call last): > File "", line 1,

gettext on Windows

2006-10-28 Thread russ . phillips . nospam
Hi, I'm trying to use gettext to internationalise my project [1], but I'm getting the following error message with some translations: "Traceback (most recent call last): file PanicButton.py line 36 in ? file Gettext.pyc line 177 in _init_ file Gettext.pyc line 274 in _parse struct.error : unpack

Re: Where do nested functions live?

2006-10-28 Thread Ben Finney
"Steven D'Aprano" <[EMAIL PROTECTED]> writes: > I defined a nested function: > > def foo(): > def bar(): > return "bar" > return "foo " + bar() > > which works. Knowing how Python loves namespaces, I thought I could > do this: > > >>> foo.bar() > Traceback (most recent call last):

Re: Where do nested functions live?

2006-10-28 Thread Steve Holden
Steven D'Aprano wrote: > I defined a nested function: > > def foo(): > def bar(): > return "bar" > return "foo " + bar() > > which works. Knowing how Python loves namespaces, I thought I could do > this: > > foo.bar() > > Traceback (most recent call last): > File "", line

Re: gettext on Windows

2006-10-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > lan = gettext.GNUTranslations (open (sLang)) are you sure the data file is a text file? what happens if you change the above to lan = gettext.GNUTranslations (open (sLang, "rb")) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: gettext on Windows

2006-10-28 Thread russ . phillips . nospam
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > lan = gettext.GNUTranslations (open (sLang)) > > are you sure the data file is a text file? what happens if you change > the above to > >lan = gettext.GNUTranslations (open (sLang, "rb")) The .mo files aren't text files, they're binary, bu

Need help (Basic python)...what did I do wrong?

2006-10-28 Thread frankie_85
Hi everyone, I just made a simple code which is part of my assignment but I can't figure it out what's wrong with it. (always give me error messages) What the code basically does is: a function that takes one floating point number x as its argument and returns (the square root of the absolute va

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Fredrik Lundh
frankie_85 wrote: > a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3))) > TypeError: 'int' object is not callable hint: in most programming languages, you have to use an explicit operator to spell out multiplication. Python's no exception. -- http://mail.python.org/mailman/listinfo/pytho

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Luuk
"frankie_85" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Hi everyone, > > I just made a simple code which is part of my assignment but I can't > figure it out what's wrong with it. (always give me error messages) > > What the code basically does is: > > a function that takes o

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread [EMAIL PROTECTED]
frankie_85 wrote: > Hi everyone, > > I just made a simple code which is part of my assignment but I can't > figure it out what's wrong with it. (always give me error messages) > > What the code basically does is: > > a function that takes one floating point number x as its argument and > returns (

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Ben Finney
"frankie_85" <[EMAIL PROTECTED]> writes: > I just made a simple code which is part of my assignment You may want to review the restrictions your educational institution has on collusion. > a function that takes one floating point number x as its argument > and returns (the square root of the abs

correct parameter usage for "select * where id in ..."

2006-10-28 Thread saniac
I am working on a little project using pysqlite. It's going to be exposed on the web, so I want to make sure I quote all incoming data correctly. However, I've run into a brick wall trying to use parameters to populate a query of the form "select * where col1 in ( ? )" The naive approach doesn't w

Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread [EMAIL PROTECTED]
Hello all, when i import SOAPpy, the python crashed and print out 'usage:copy source destination'. As follows: haiyun# python Python 2.4.1 (#2, Mar 28 2006, 21:00:14) [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5 Type "help", "copyright", "credits" or "license" for more in

Re: Where do nested functions live?

2006-10-28 Thread Fredrik Lundh
Ben Finney wrote: > If you want something that can be called *and* define its attributes, > you want something more complex than the default function type. Define > a class that has a '__call__' attribute, make an instance of that, and > you'll be able to access attributes and call it like a funct

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > when i import SOAPpy, the python crashed and print out 'usage:copy > source destination'. > As follows: > > haiyun# python > Python 2.4.1 (#2, Mar 28 2006, 21:00:14) > [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5 > Type "help", "copyright", "cr

Re: Where do nested functions live?

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 09:59:29 +0200, Fredrik Lundh wrote: >> where do nested functions live? > > in the local variable of an executing function, just like the variable > "bar" in the following function: > > def foo(): > bar = "who am I? where do I live?" > > (yes, an inner functio

Re: gettext on Windows

2006-10-28 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Traceback (most recent call last): > File "panicbutton.py", line 36, in ? > lan = gettext.GNUTranslations (open (sLang, "rb")) > File "C:\Python24\lib\gettext.py", line 177, in __init__ > self._parse(fp) > File "C:\Python24\lib\gettext.py", line 280, in _p

Re: gettext on Windows

2006-10-28 Thread russ . phillips . nospam
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > Traceback (most recent call last): > > File "panicbutton.py", line 36, in ? > > lan = gettext.GNUTranslations (open (sLang, "rb")) > > File "C:\Python24\lib\gettext.py", line 177, in __init__ > > self._parse(fp) > > File "C:\Pyt

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 18:56:33 +1000, Ben Finney wrote: > "frankie_85" <[EMAIL PROTECTED]> writes: > >> I just made a simple code which is part of my assignment > > You may want to review the restrictions your educational institution > has on collusion. [snip] > Again, please make sure you work on

Re: question about True values

2006-10-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Fri, 27 Oct 2006 11:25:09 -0700, Carl Banks wrote: > >> Iterators do have overlapping uses with lists, but the "if a:" doesn't >> work for them, so it's moot. > > Sure it works for iterators. > it = iter([0]) bool(it) > True it.

Re: Where do nested functions live?

2006-10-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > Does this mean I'm wasting my time writing doc strings for nested > functions? If there is no way of accessing them externally, should I make > them mere # comments? Whats the difference in "wasted time" between using """ or # as delimiters for the

Re: gettext on Windows

2006-10-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Martin v. Löwis wrote: > > [EMAIL PROTECTED] schrieb: > > > Traceback (most recent call last): > > > File "panicbutton.py", line 36, in ? > > > lan = gettext.GNUTranslations (open (sLang, "rb")) > > > File "C:\Python24\lib\gettext.py", line 177, in __init__ > > >

Sending mouse events on Windows

2006-10-28 Thread Radu Ciurlea
Hello, I want to write a program that can generate mouse events. I'd like to actually be able to control the pointer and generate clicks. Any pointers on modules I could use for doing this? Any suggestions are welcome. tia Radu -- http://mail.python.org/mailman/listinfo/python-list

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread Steve Holden
saniac wrote: > I am working on a little project using pysqlite. It's going to be > exposed on the web, so I want to make sure I quote all incoming data > correctly. However, I've run into a brick wall trying to use parameters > to populate a query of the form "select * where col1 in ( ? )" > > Th

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread James Stroud
Steven D'Aprano wrote: > On Sat, 28 Oct 2006 18:56:33 +1000, Ben Finney wrote: > >> "frankie_85" <[EMAIL PROTECTED]> writes: >> >>> I just made a simple code which is part of my assignment >> You may want to review the restrictions your educational institution >> has on collusion. > [snip] >> Agai

Safely renaming a file without overwriting

2006-10-28 Thread Steven D'Aprano
I want to rename a file, but only if the destination file name doesn't already exist. I can do this: if os.path.exists(dest): # skip file, raise an exception, make a backup... do_something_else() else: os.rename(src, dest) But on a multi-user system, it is possible that dest is cre

Re: Sending mouse events on Windows

2006-10-28 Thread Fredrik Lundh
Radu Ciurlea wrote: > I want to write a program that can generate mouse events. I'd like to > actually be able to control the pointer and generate clicks. Any > pointers on modules I could use for doing this? Any suggestions are > welcome. something like http://www.tizmoi.net/watsup/intro.ht

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread Frank Millman
saniac wrote: > I am working on a little project using pysqlite. It's going to be > exposed on the web, so I want to make sure I quote all incoming data > correctly. However, I've run into a brick wall trying to use parameters > to populate a query of the form "select * where col1 in ( ? )" > > Th

Re: question about True values

2006-10-28 Thread Carl Banks
Steven D'Aprano wrote: > On Fri, 27 Oct 2006 11:25:09 -0700, Carl Banks wrote: > > > Steven D'Aprano wrote: > >> But in this specific instance, I don't see any advantage to explicitly > >> testing the length of a list. Antoon might think that is sufficiently > >> polymorphic, but it isn't. He cares

Re: ANN: the pyfaq wiki has moved

2006-10-28 Thread Fredrik Lundh
John Salerno wrote: > Ok. I was trying the "edit" link instead. ah, of course. I've moved the admin links a bit, to make the difference more obvious. thanks /F -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-28 Thread Georg Brandl
J. Clifford Dyer wrote: > >>> (1 > 0) < 1 > False > >>> 1 > 0 < 1 > True > >>> 1 > (0 < 1) > False > >>> 10 > (0 < 1) > True I hope you know why this works the way it does. Georg -- http://mail.python.org/mailman/listinfo/python-list

Import if condition is correct

2006-10-28 Thread MindClass
Is possible import a library according to a condition? if Foo = True: import bar -- http://mail.python.org/mailman/listinfo/python-list

Re: Import if condition is correct

2006-10-28 Thread Georg Brandl
MindClass wrote: > Is possible import a library according to a condition? > > if Foo = True: > import bar > Why don't you try it? (in the above code, not the import is the problem, but using the assignment operator in an expression) Georg -- http://mail.python.org/mailman/listinfo/python-

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Antoine De Groote
frankie_85 wrote: > Hi everyone, > > I just made a simple code which is part of my assignment but I can't > figure it out what's wrong with it. (always give me error messages) > > What the code basically does is: > > a function that takes one floating point number x as its argument and > returns

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread paul
Frank Millman schrieb: > If you want it to handle a variable number of values, you will have to > programmatically construct the sql statement with the appropriate > number of parameters. >>> vals = (1,2,3,4,5) >>> sql = "select * from table where value in ("+','.join("?"*len(vals))+")" >>> print s

Re: Import if condition is correct

2006-10-28 Thread MindClass
Georg Brandl wrote: > MindClass wrote: > > Is possible import a library according to a condition? > > > > if Foo == True: > > import bar > > > > Why don't you try it? > I thinked that could be another way for import statement. In that case I'll have to set a global variable before of the impo

Re: Arrays? (Or lists if you prefer)

2006-10-28 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote: >> As an example of using pyparsing, I chose a simple text adventure >> application, and had to create a 2-D grid of rooms. The presentation >> materials are online at http://www.python.org/pycon/2006/papers/4/, and

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Georg Brandl wrote: > >>MindClass wrote: >> >>>Is possible import a library according to a condition? >>> >>>if Foo == True: >>>import bar >>> >> >>Why don't you try it? >> > > I thinked that could be another way for import statement. > > In that case I'll have to set a gl

Re: question about True values

2006-10-28 Thread Steven D'Aprano
On Sat, 28 Oct 2006 11:42:42 +0200, Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Steven > D'Aprano wrote: > >> On Fri, 27 Oct 2006 11:25:09 -0700, Carl Banks wrote: >> >>> Iterators do have overlapping uses with lists, but the "if a:" doesn't >>> work for them, so it's moot. >> >>

Re: what are the most frequently used functions?

2006-10-28 Thread robert
Xah Lee wrote: > I had a idea today. > > I wanted to know what are the top most frequently used functions in the > emacs lisp language. I thought i can write a quick script that go thru > all the elisp library locations and get a word-frequency report i want. > > I started with a simple program:

Re: Import if condition is correct

2006-10-28 Thread MindClass
Steve Holden wrote: > I'm guessing that you think this might be necessary to avoid importing > the same module multiple times: it's not. Python only runs the module's > code the first time the module is imported into a program. A further > import statement effectively does noting, because the inte

Re: what are the most frequently used functions?

2006-10-28 Thread J�rgen Exner
> Xah Lee wrote: >> I had a idea today. Oh, really? You should mark your calendar and celebrate the day annually!!! >> I wanted to know what are the top most frequently used functions in >> the emacs lisp language. And the relationship with Perl, Python, Java is exactly what? jue -- http://

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Steven D'Aprano wrote: > I want to rename a file, but only if the destination file name > doesn't already exist. > > I can do this: > > if os.path.exists(dest): > # skip file, raise an exception, make a backup... > do_something_else() > else: > os.rename(src, dest) > > > But on a m

subprocess decoding?

2006-10-28 Thread MC
Hi! On win-XP (french), when I read subprocess (stdout), I must use differents decoding (cp1252,cp850,cp437, or no decoding), depending of the "launch mode" of the same Python's script: - from command-line - from start+run - from icon - by Python-COM-server - etc. (.py & .pyw can also

ANN: Leo 4.4.2 final released

2006-10-28 Thread Edward K. Ream
Leo 4.4.2 final is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This release fixes a few bugs and adds support for controlling Leo from Emacs using pymacs. There are no known significant bugs in this version of Leo. Leo is a text editor, data orga

Re: What is the cleanest way to for a module to access objects from the script that imports it?

2006-10-28 Thread robert
[EMAIL PROTECTED] wrote: > Hi, > > I am new to python and am currently writing my first application. One > of the problems I quickly ran into, however, is that python's imports > are very different from php/C++ includes in the sense that they > completely wrap the imported script in a module objec

Re: python GUIs comparison (want)

2006-10-28 Thread Jarek Zgoda
Christophe napisał(a): >> PyGtk: >> Pro: Sophisticated GUI's, cross-platform (Linux and Win32); very popular >> on some platforms; active development community >> Con: Not native on OS X > > You forgot that it is rather buggy on Win32 ( in my experience ) Didn't observe any W32-specific bugy beh

Re: what are the most frequently used functions?

2006-10-28 Thread robert
Jürgen Exner wrote: >> Xah Lee wrote: >>> I had a idea today. > > Oh, really? You should mark your calendar and celebrate the day annually!!! > >>> I wanted to know what are the top most frequently used functions in >>> the emacs lisp language. > > And the relationship with Perl, Python, Java is

Re: Import if condition is correct

2006-10-28 Thread Steve Holden
MindClass wrote: > Steve Holden wrote: > >>I'm guessing that you think this might be necessary to avoid importing >>the same module multiple times: it's not. Python only runs the module's >>code the first time the module is imported into a program. A further >>import statement effectively does not

Re: gettext on Windows

2006-10-28 Thread russ . phillips . nospam
Leo Kislov wrote: > Try msgunfmt > http://www.gnu.org/software/gettext/manual/html_node/gettext_128.html#SEC128 > to see if it can convert your files back to text. Just tried it, and it was able to convert each of the .mo files back to text without any problems. Russ -- http://mail.python.org/

Mass-Renaming folders win32

2006-10-28 Thread evaisse
I've a folder structure like this : "Folder A" |--> "1" |--> "2" ---> "3" "Folder B" |--> "4" ---> "5" And I want to obtain a structure like this : "Folder A - 1" "Folder A - 2" "Folder A - 3" "Folder B - 4" "Folder B - 5" Can someone help me ? I am python beginner -- http://mail.python.org

Re: what are the most frequently used functions?

2006-10-28 Thread Dr.Ruud
robert schreef: > read more of the context and answer to the OP That OP is invisible in most relevant contexts. -- Affijn, Ruud "Gewoon is een tijger." -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt-x11-gpl-3.16 compile error

2006-10-28 Thread David Boddie
On Saturday 28 October 2006 06:42, [EMAIL PROTECTED] wrote: > here is th output : > > [EMAIL PROTECTED] PyQt-x11-gpl-3.16]# python configure.py -q > /usr/lib/qt-3.3/ -w [...] > Checking to see if the qtcanvas module should be built... > /usr/bin/ld: cannot find -lXext > collect2: ld returned 1

PROBLEM with MOD_PYTHON

2006-10-28 Thread dan84
I don't understand this error , in the (Apache) errorlog I read this message : [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import mod_python.apache.\n [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being used "['C:Python24python24.zip', '.DLLs', '.\\\

Reading standard input

2006-10-28 Thread MindClass
The program shows a license text, then the user has to accept the license (or not). Is there another way to get text from console? (that using sys.stdin.read) foo = sys.stdin.read(3) if foo != 'yes' sys.exit(0) I also would to trap the KeyboardInterrupt for that doesn't show that message. How

Re: Sending mouse events on Windows

2006-10-28 Thread Radu Ciurlea
Looks good, but I downloaded it and it's not that helpful. It can only simulate clicks to interface objects. I need to actually move the mouse pointer around. I just want to write a small app that'll enable me to use my mobile phone as a mouse via Bluetooth, but not being able to move the pointer k

Re: Mass-Renaming folders win32

2006-10-28 Thread Tim Chase
> I've a folder structure like this : > > "Folder A" > |--> "1" > |--> "2" > ---> "3" > > "Folder B" > |--> "4" > ---> "5" > > And I want to obtain a structure like this : > > "Folder A - 1" > "Folder A - 2" > "Folder A - 3" > "Folder B - 4" > "Folder B - 5" > > Can someone help me ? I am pyth

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 18:22:28 +, Antoon Pardon wrote: > And how do I express that a number has to be greater than 100 into a Nothing vs Something dichotomy? Declare all greater numbers as Something and the rest as Nothing

Re: Leo 4.4.2 final released: config bug

2006-10-28 Thread Edward K. Ream
Drat. Leo does not remember recent files unless .leoRecentFiles.txt exists in Leo's config directory. Alas, that file is (on purpose) not part of the distribution, and Leo only creates .leoRecentFiles.txt in the users home directory. So most users will have to create .leoRecentFiles.txt in Le

Re: question about True values

2006-10-28 Thread Antoon Pardon
On 2006-10-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 27 Oct 2006 17:35:58 +, Antoon Pardon wrote: > >> On 2006-10-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> So >> it seems that python has generalised the len function to provide >> the number of elements in the containe

Re: using mmap on large (> 2 Gig) files

2006-10-28 Thread Chetan
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Martin v. Löwis wrote: > > sturlamolden schrieb: > > > > > And why doesn't Python's mmap take an offset argument to handle large > > > files? > > > > I don't know exactly; the most likely reason is that nobody has > > contributed code to make it su

Re: Where do nested functions live?

2006-10-28 Thread Andrea Griffini
Fredrik Lundh wrote: > Ben Finney wrote: > >> If you want something that can be called *and* define its attributes, >> you want something more complex than the default function type. Define >> a class that has a '__call__' attribute, make an instance of that, and >> you'll be able to access attrib

Re: Reading standard input

2006-10-28 Thread Fredrik Lundh
MindClass wrote: > The program shows a license text, then the user has to accept the > license (or not). > Is there another way to get text from console? (that using > sys.stdin.read) http://effbot.org/pyref/raw_input.htm > I also would to trap the KeyboardInterrupt for that doesn't show that >

Re: what are the most frequently used functions?

2006-10-28 Thread Barry Margolin
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > I had a idea today. > > I wanted to know what are the top most frequently used functions in the > emacs lisp language. I thought i can write a quick script that go thru > all the elisp library locations and get a word-frequen

Re: Safely renaming a file without overwriting

2006-10-28 Thread Diez B. Roggisch
Wolfgang Draxinger schrieb: > Steven D'Aprano wrote: > >> I want to rename a file, but only if the destination file name >> doesn't already exist. >> >> I can do this: >> >> if os.path.exists(dest): >> # skip file, raise an exception, make a backup... >> do_something_else() >> else: >>

latest numpy & scipy - incompatible ?

2006-10-28 Thread robert
I'm using latest numpy & scipy. What is this problem ? : >>> import scipy.stats RuntimeError: module compiled against version 102 of C-API but this version of numpy is 109 Traceback (most recent call last): File "", line 1, in ? File "C:\PYTHON23\Lib\site-packages\scipy\stats\__init__

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > > this is how things work: Python doesn't distinguish between script > files and module files; a module is simply a script that defines a > bunch of things. > > if you want to create something that can work both as a script and a > module, see: > > http://effbot.org/pyfa

Re: Python crashed when importing SOAPpy, printing out 'usage:copy source destination'

2006-10-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I still can't understand it. If i rename the 'copy.py' to 'a.py', > there will be no problem. hint: when it works, try typing the following into the interpreter: >>> import copy >>> copy.__file__ -- http://mail.python.org/mailman/listinfo/python-list

Re: change keybindings for pygtk treeview

2006-10-28 Thread Fabian Braennstroem
Hi, * Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I am just testing pygtk/glade out and wonder, if I am able > to change the keybindings. E.g. the treeview searches by > default for the entries beginning with the typed keystroke; > moving to the next row works as usual with the Down k

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread Chetan
"dan84" <[EMAIL PROTECTED]> writes: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Fredrik Lundh
Steven D'Aprano wrote: > I don't think the restrictions against collusion are meant to prohibit > simple "what does this error message mean?" type questions. It would be > a funny sort of learning process that forced students to live in a > vacuum, never discussing their topic with anyone else, ne

Where is __builtin__

2006-10-28 Thread ArdPy
Most of the other modules have an accompanying python source file. But that is not the case with __builtin__. What might be the reason? Isn't __builtin__ written in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is __builtin__

2006-10-28 Thread Fredrik Lundh
ArdPy wrote: > Most of the other modules have an accompanying python source file. But > that is not the case with __builtin__. What might be the reason? Isn't > __builtin__ written in python? http://www.effbot.org/pyfaq/where-is-the-math-py-socket-py-regex-py-etc-source-file.htm -- http://mai

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread frankie_85
Thanks for some of the helps guys. Hmmmafter more trials and errors, I think what I did wrong is along on these lines: a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3))) b_2 = math.sqrt(math.fabs(b)) + 5((math.pow(b,3))) c_3 = math.sqrt(math.fabs(c)) + 5((math.pow(c,3))) d_4 = math.sqrt(math.

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread J. Clifford Dyer
dan84 wrote: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C:Python24python

Re: Safely renaming a file without overwriting

2006-10-28 Thread Wolfgang Draxinger
Diez B. Roggisch wrote: >> 1: Open the file with os.open >> >> 2: Lock the file exclusively -> no other process can now >> access it. >> >> 3: Use rename to rename the file; this causes a file system >> level implicit unlink of the old file (it dissappears from the >> file system) but the openin

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Paul Rubin
"frankie_85" <[EMAIL PROTECTED]> writes: > e_5 = math.sqrt(math.fabs(e)) + 5((math.pow(e,3))) > > but I still don't understand though why the variable a, b, c, d, e > becomes an int type even though I have already specified the user input > to be floating point? if you want to multiply two number

Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Fredrik Lundh
frankie_85 wrote: > Hmmmafter more trials and errors, I think what I did wrong is along > on these lines: > > a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3))) > b_2 = math.sqrt(math.fabs(b)) + 5((math.pow(b,3))) > c_3 = math.sqrt(math.fabs(c)) + 5((math.pow(c,3))) > d_4 = math.sqrt(math.fab

Re: Where do nested functions live?

2006-10-28 Thread Frederic Rentsch
Fredrik Lundh wrote: > Steven D'Aprano wrote: > > >> I defined a nested function: >> >> def foo(): >> def bar(): >> return "bar" >> return "foo " + bar() >> >> which works. Knowing how Python loves namespaces, I thought I could do >> this: >> >> > foo.bar() >

Re: Where do nested functions live?

2006-10-28 Thread Diez B. Roggisch
> If I may turn the issue around, I could see a need for an inner function > to be able to access the variables of the outer function, the same way a > function can access globals. Why? Because inner functions serve to > de-multiply code segments one would otherwise need to repeat or to > provi

Re: ANN: wxPython 2.7.1.3

2006-10-28 Thread Hendrik van Rooyen
"Johann C. Rocholl" <[EMAIL PROTECTED]>wrote: 8<-- > Oh, it's fun to be a speling fanatic! :-) six munce ago I could not even spell 'fatanic' - and now I are one... I wander what a speling fanatic is? - Hendrik -- http://mail.python.org/mailman/listinfo/p

Re: Where is __builtin__

2006-10-28 Thread Michel Claveau
Hi! >> http://www.effbot.org/pyfaq/where-is-the-math-py-socket-py-regex-py-etc-source-file.htm Yeaaahh!!!Finally a genuine URL;o) -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: wxPython 2.7.1.3

2006-10-28 Thread Tim N. van der Leeuw
Hendrik van Rooyen wrote: > "Johann C. Rocholl" <[EMAIL PROTECTED]>wrote: > > 8<-- > > > Oh, it's fun to be a speling fanatic! :-) > > > six munce ago I could not even spell 'fatanic' - and now I are one... > > I wander what a speling fanatic is? > Someone who

Re: Safely renaming a file without overwriting

2006-10-28 Thread Chetan
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I want to rename a file, but only if the destination file name doesn't > already exist. > > I can do this: > > if os.path.exists(dest): > # skip file, raise an exception, make a backup... > do_something_else() > else: > os.rename(src, de

stripping parts of elements in a list

2006-10-28 Thread CSUIDL PROGRAMMEr
folks, I am new to python. I have a list made of elements ['amjad\n', 'kiki\n', 'jijiji\n'] I am trying to get rid of '\n' after each name. to get list as ['amjad','kiki','jijiji'] But list does not have a strip function as string does have. is there any solutions Is there a way this can be

Re: stripping parts of elements in a list

2006-10-28 Thread Paul Rubin
"CSUIDL PROGRAMMEr" <[EMAIL PROTECTED]> writes: > ['amjad\n', 'kiki\n', 'jijiji\n'] > I am trying to get rid of '\n' after each name. > to get list as > ['amjad','kiki','jijiji'] > > But list does not have a strip function as string does have. > > is there any solutions a = ['amjad\n', 'kiki\n

what is "@param" in docstrings?

2006-10-28 Thread georgeryoung
I'm starting to read about twisted and I keep seeing things like: [from twisted/internet/app.py] def __init__(self, name, uid=None, gid=None, authorizer=None, authorizer_=None): """Initialize me. If uid and gid arguments are not provided, this application will default t

Re: what is "@param" in docstrings?

2006-10-28 Thread Georg Brandl
[EMAIL PROTECTED] wrote: > I'm starting to read about twisted and I keep seeing things like: > [from twisted/internet/app.py] > > def __init__(self, name, uid=None, gid=None, authorizer=None, > authorizer_=None): > """Initialize me. > If uid and gid arguments are not provided,

Re: what is "@param" in docstrings?

2006-10-28 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > What does the "@param" mean? It looks like something meant to be > machine readable. Alas, googling on "@param" doesn't work... It looks > at first like a decorator, but that doesn't make much sense. It's Epydoc's Epytext markup: . --

Re: gettext on Windows

2006-10-28 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Leo Kislov wrote: > >> Try msgunfmt >> http://www.gnu.org/software/gettext/manual/html_node/gettext_128.html#SEC128 >> to see if it can convert your files back to text. > > Just tried it, and it was able to convert each of the .mo files back to > text without any prob

Re: correct parameter usage for "select * where id in ..."

2006-10-28 Thread saniac
paul wrote: > Frank Millman schrieb: > > If you want it to handle a variable number of values, you will have to > > programmatically construct the sql statement with the appropriate > > number of parameters. Yes, I should have made it clear it was the variable part that was hard. > >>> vals = (1,

unescape HTML entities

2006-10-28 Thread Rares Vernica
Hi, How can I unescape HTML entities like " "? I know about xml.sax.saxutils.unescape() but it only deals with "&", "<", and ">". Also, I know about htmlentitydefs.entitydefs, but not only this dictionary is the opposite of what I need, it does not have " ". It has to be in python 2.4. Thank

Re: question about True values

2006-10-28 Thread J. Clifford Dyer
Georg Brandl wrote: > J. Clifford Dyer wrote: > >> >>> (1 > 0) < 1 >> False >> >>> 1 > 0 < 1 >> True >> >>> 1 > (0 < 1) >> False >> >>> 10 > (0 < 1) >> True > > I hope you know why this works the way it does. > > Georg Yes, I do understand why it works. I couldn't have crafted it if I did

Re: question about True values

2006-10-28 Thread Georg Brandl
J. Clifford Dyer wrote: > Georg Brandl wrote: >> J. Clifford Dyer wrote: >> >>> >>> (1 > 0) < 1 >>> False >>> >>> 1 > 0 < 1 >>> True >>> >>> 1 > (0 < 1) >>> False >>> >>> 10 > (0 < 1) >>> True >> >> I hope you know why this works the way it does. >> >> Georg > > Yes, I do understand why it

  1   2   >